From eb4c575f54405706a674240a145a16d4b759d706 Mon Sep 17 00:00:00 2001 From: tamil Date: Thu, 12 Sep 2013 15:03:10 -0700 Subject: [PATCH] made help more readable Signed-off-by: tamil --- teuthology/lock.py | 18 ++++++++++++++---- teuthology/nuke.py | 12 +++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/teuthology/lock.py b/teuthology/lock.py index 2869196aa35..7f3b0fcfa03 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -9,6 +9,7 @@ import collections import tempfile import os import time +import textwrap from argparse import RawTextHelpFormatter from teuthology import lockstatus as ls @@ -112,9 +113,18 @@ def canonicalize_hostname(s): return s def main(): - parser = argparse.ArgumentParser(description='Lock, unlock, or query lock status of machines', -epilog='Examples: \n teuthology-lock --summary \n teuthology-lock --lock-many 1 --machine-type vps \n teuthology-lock --lock -t target.yaml \n teuthology-lock --list-targets plana01 \n teuthology-lock --list --brief --owner user@host \n teuthology-lock --update --status down --desc testing plana01', -formatter_class=RawTextHelpFormatter) + parser = argparse.ArgumentParser( + description='Lock, unlock, or query lock status of machines', + epilog=textwrap.dedent(''' + Examples: + teuthology-lock --summary + teuthology-lock --lock-many 1 --machine-type vps + teuthology-lock --lock -t target.yaml + teuthology-lock --list-targets plana01 + teuthology-lock --list --brief --owner user@host + teuthology-lock --update --status down --desc testing plana01 + '''), + formatter_class=RawTextHelpFormatter) parser.add_argument( '-v', '--verbose', action='store_true', @@ -194,7 +204,7 @@ formatter_class=RawTextHelpFormatter) parser.add_argument( '--machine-type', default=None, - help='Type of machine to lock.It could be mira or plana or burnupi or vps or saya or tala', + help='Type of machine to lock, valid choices: mira | plana | burnupi | vps | saya | tala', ) parser.add_argument( '--status', diff --git a/teuthology/nuke.py b/teuthology/nuke.py index 6659a6870cc..626a550afcc 100644 --- a/teuthology/nuke.py +++ b/teuthology/nuke.py @@ -1,14 +1,20 @@ import argparse import yaml +import textwrap from argparse import RawTextHelpFormatter def parse_args(): from teuthology.run import config_file from teuthology.run import MergeConfig - parser = argparse.ArgumentParser(description='Reset test machines', -epilog='Examples: \n teuthology-nuke -t target.yaml --unlock --owner user@host \n teuthology-nuke -t target.yaml --pid 1234 --unlock --owner user@host \n', -formatter_class=RawTextHelpFormatter) + parser = argparse.ArgumentParser( + description='Reset test machines', + epilog=textwrap.dedent(''' + Examples: + teuthology-nuke -t target.yaml --unlock --owner user@host + teuthology-nuke -t target.yaml --pid 1234 --unlock --owner user@host \n + '''), + formatter_class=RawTextHelpFormatter) parser.add_argument( '-v', '--verbose', action='store_true', default=None,