pmbootstrap config -h: show keys / tab complete (!1729)

Show all config keys that can be queried and set in the
'pmbootstrap config -h' output and make tab completion work for the
key names.

I've set "metavar" and placed the variables in the helpstring. That
way, argparse will not generate a huge "positional arguments" string
that blows up the layout of the help output:
[{ccache_size,device,extra_packages,hostname,jobs,kernel,keymap,...
This commit is contained in:
Oliver Smith 2018-12-14 08:48:40 +01:00
parent c4b4aa7252
commit 60f12ae2df
1 changed files with 3 additions and 1 deletions

View File

@ -494,7 +494,9 @@ def arguments():
# Action: config
config = sub.add_parser("config",
help="get and set pmbootstrap options")
config.add_argument("name", nargs="?", help="variable name")
config.add_argument("name", nargs="?", help="variable name, one of: " +
", ".join(sorted(pmb.config.config_keys)),
choices=pmb.config.config_keys, metavar="name")
config.add_argument("value", nargs="?", help="set variable to value")
# Action: bootimg_analyze