From 60f12ae2df0a490fa2e1a84a457484724577f472 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 14 Dec 2018 08:48:40 +0100 Subject: [PATCH] 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,... --- pmb/parse/arguments.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index 7bb58b82..1f86b0ed 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -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