Clean up help metavar for --scope configuration options
- previously commands with this argument showed a long list of choices that were platform specific. - use a better metavar: {defaults,system,site,user}[/PLATFORM]
This commit is contained in:
parent
de3c047105
commit
2b7dfcd19f
@ -54,7 +54,8 @@ def setup_parser(subparser):
|
||||
help='search the system for compilers to add to Spack configuration')
|
||||
find_parser.add_argument('add_paths', nargs=argparse.REMAINDER)
|
||||
find_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_modify_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_modify_scope,
|
||||
help="configuration scope to modify")
|
||||
|
||||
# Remove
|
||||
@ -65,20 +66,23 @@ def setup_parser(subparser):
|
||||
help='remove ALL compilers that match spec')
|
||||
remove_parser.add_argument('compiler_spec')
|
||||
remove_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_modify_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_modify_scope,
|
||||
help="configuration scope to modify")
|
||||
|
||||
# List
|
||||
list_parser = sp.add_parser('list', help='list available compilers')
|
||||
list_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_list_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_list_scope,
|
||||
help="configuration scope to read from")
|
||||
|
||||
# Info
|
||||
info_parser = sp.add_parser('info', help='show compiler paths')
|
||||
info_parser.add_argument('compiler_spec')
|
||||
info_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_list_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_list_scope,
|
||||
help="configuration scope to read from")
|
||||
|
||||
|
||||
|
@ -31,7 +31,9 @@
|
||||
|
||||
|
||||
def setup_parser(subparser):
|
||||
subparser.add_argument('--scope', choices=spack.config.config_scopes,
|
||||
scopes = spack.config.config_scopes
|
||||
subparser.add_argument(
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
help="configuration scope to read/modify")
|
||||
|
||||
|
||||
|
@ -31,7 +31,9 @@
|
||||
|
||||
def setup_parser(subparser):
|
||||
# User can only choose one
|
||||
subparser.add_argument('--scope', choices=spack.config.config_scopes,
|
||||
subparser.add_argument(
|
||||
'--scope', choices=spack.config.config_scopes,
|
||||
metavar=spack.config.scopes_metavar,
|
||||
help="configuration scope to read/modify")
|
||||
|
||||
sp = subparser.add_subparsers(metavar='SUBCOMMAND', dest='config_command')
|
||||
|
@ -75,7 +75,8 @@ def setup_parser(subparser):
|
||||
add_parser.add_argument(
|
||||
'url', help="url of mirror directory from 'spack mirror create'")
|
||||
add_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_modify_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_modify_scope,
|
||||
help="configuration scope to modify")
|
||||
|
||||
# Remove
|
||||
@ -83,13 +84,15 @@ def setup_parser(subparser):
|
||||
help=mirror_remove.__doc__)
|
||||
remove_parser.add_argument('name')
|
||||
remove_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_modify_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_modify_scope,
|
||||
help="configuration scope to modify")
|
||||
|
||||
# List
|
||||
list_parser = sp.add_parser('list', help=mirror_list.__doc__)
|
||||
list_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_list_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_list_scope,
|
||||
help="configuration scope to read from")
|
||||
|
||||
|
||||
|
@ -52,7 +52,8 @@ def setup_parser(subparser):
|
||||
# List
|
||||
list_parser = sp.add_parser('list', help=repo_list.__doc__)
|
||||
list_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_list_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_list_scope,
|
||||
help="configuration scope to read from")
|
||||
|
||||
# Add
|
||||
@ -60,7 +61,8 @@ def setup_parser(subparser):
|
||||
add_parser.add_argument(
|
||||
'path', help="path to a Spack package repository directory")
|
||||
add_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_modify_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_modify_scope,
|
||||
help="configuration scope to modify")
|
||||
|
||||
# Remove
|
||||
@ -70,7 +72,8 @@ def setup_parser(subparser):
|
||||
'path_or_namespace',
|
||||
help="path or namespace of a Spack package repository")
|
||||
remove_parser.add_argument(
|
||||
'--scope', choices=scopes, default=spack.cmd.default_modify_scope,
|
||||
'--scope', choices=scopes, metavar=spack.config.scopes_metavar,
|
||||
default=spack.cmd.default_modify_scope,
|
||||
help="configuration scope to modify")
|
||||
|
||||
|
||||
|
@ -88,6 +88,10 @@
|
||||
#: Later scopes will override earlier scopes.
|
||||
config_scopes = OrderedDict()
|
||||
|
||||
#: metavar to use for commands that accept scopes
|
||||
#: this is shorter and more readable than listing all choices
|
||||
scopes_metavar = '{defaults,system,site,user}[/PLATFORM]'
|
||||
|
||||
|
||||
def validate_section_name(section):
|
||||
"""Exit if the section is not a valid section."""
|
||||
|
Loading…
Reference in New Issue
Block a user