diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-07-25 13:56:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-25 13:56:27 -0700 |
commit | 6ad6cbf33fe203e504c8623631746068850ee16f (patch) | |
tree | 63d5e46943761b9d49f3ffe4d3ae235ddd395ed6 /alot/__main__.py | |
parent | ce7bda011f1e0efe2edc8eb04311ca6bc384989f (diff) | |
parent | 474f7c8477ed6c88c56815a09cc98a7cabc4f70d (diff) |
Merge pull request #1276 from alexshpilkin/copyedit
Copyedit documentation
Diffstat (limited to 'alot/__main__.py')
-rw-r--r-- | alot/__main__.py | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/alot/__main__.py b/alot/__main__.py index 0d100134..221e6b22 100644 --- a/alot/__main__.py +++ b/alot/__main__.py @@ -23,35 +23,40 @@ _SUBCOMMANDS = ['search', 'compose', 'bufferlist', 'taglist', 'namedqueries', def parser(): """Parse command line arguments, validate them, and return them.""" - parser = argparse.ArgumentParser() - parser.add_argument('-v', '--version', action='version', - version=alot.__version__) + parser = argparse.ArgumentParser(add_help=False) parser.add_argument('-r', '--read-only', action='store_true', - help='open db in read only mode') - parser.add_argument('-c', '--config', + help='open notmuch database in read-only mode') + parser.add_argument('-c', '--config', metavar='FILENAME', action=cargparse.ValidatedStoreAction, validator=cargparse.require_file, - help='config file') - parser.add_argument('-n', '--notmuch-config', default=os.environ.get( + help='configuration file') + parser.add_argument('-n', '--notmuch-config', metavar='FILENAME', + default=os.environ.get( 'NOTMUCH_CONFIG', os.path.expanduser('~/.notmuch-config')), action=cargparse.ValidatedStoreAction, validator=cargparse.require_file, - help='notmuch config') - parser.add_argument('-C', '--colour-mode', + help='notmuch configuration file') + parser.add_argument('-C', '--colour-mode', metavar='COLOURS', choices=(1, 16, 256), type=int, - help='terminal colour mode') - parser.add_argument('-p', '--mailindex-path', + help='number of colours to use') + parser.add_argument('-p', '--mailindex-path', metavar='PATH', action=cargparse.ValidatedStoreAction, validator=cargparse.require_dir, help='path to notmuch index') - parser.add_argument('-d', '--debug-level', default='info', + parser.add_argument('-d', '--debug-level', metavar='LEVEL', default='info', choices=('debug', 'info', 'warning', 'error'), - help='debug log [default: %(default)s]') - parser.add_argument('-l', '--logfile', default='/dev/null', + help='debug level [default: %(default)s]') + parser.add_argument('-l', '--logfile', metavar='FILENAME', + default='/dev/null', action=cargparse.ValidatedStoreAction, validator=cargparse.optional_file_like, - help='logfile [default: %(default)s]') + help='log file [default: %(default)s]') + parser.add_argument('-h', '--help', action='help', + help='display this help and exit') + parser.add_argument('-v', '--version', action='version', + version=alot.__version__, + help='output version information and exit') # We will handle the subcommands in a separate run of argparse as argparse # does not support optional subcommands until now. parser.add_argument('command', nargs=argparse.REMAINDER, |