Skip to contentSkip to conversation

autobuild-run: show options along with their defaults

PATCH New André Erdmann 2 participants 2 messages May 1, 2015 – May 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 autobuild-run: show options along with their defaults

Currently, the default values for options are printed at the end of the help message, so there is a visual distance between the "--<option>" help and its default value that increases with every newly introduced option.

Move them closer together by means of str-dict formatting, "%(key)s".

"[default: ]" cannot be used as it gets parsed by docopt, using "Defaults to ...", "Not set by default", ... phrases instead.

---
 scripts/autobuild-run | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
scripts/autobuild-run +9 -6
index 0e12080..6d029b5 100755
@@ -74,17 +74,23 @@ Options:
   -h, --help                     show this help message and exit
   -V, --version                  show version
   -n, --ninstances NINSTANCES    number of parallel instances
+                                 Defaults to %(--ninstances)s.
   -j, --njobs NJOBS              number of parallel jobs
+                                 Defaults to %(--njobs)s.
   -s, --submitter SUBMITTER      name/machine of submitter
+                                 Defaults to %(--submitter)s.
   --http-login LOGIN             username to send results with
+                                 Not set by default.
   --http-password PASSWORD       password to send results with (for security
                                  reasons it is recommended to define this in the
                                  config file instead, with user-read permissions
                                  only)
+                                 Not set by default.
   --make-opts OPTSTRING          string of extra options to pass to Buildroot
                                  make, such as specific command wrappers
-                                 [default: ]
+                                 Empty by default.
   -c, --config CONFIG            path to configuration file
+                                 Not set by default.
 
 Format of the configuration file:
 
@@ -99,11 +105,8 @@ Format of the configuration file:
    http-password = <value>
    submitter = <value>
 
-Default values for the arguments are:
 
-  %s
-""" % '\n  '.join(
-    ['%s = %s' % (key, val) for (key, val) in defaults.items()])
+""" % defaults
 
 __doc__ = doc
 
@@ -839,7 +842,7 @@ def main():
                 http_login = args['--http-login'],
                 http_password = args['--http-password'],
                 submitter = args['--submitter'],
-                make_opts = args['--make-opts'],
+                make_opts = (args['--make-opts'] or ''),
                 upload = upload,
                 buildpid = buildpid
             ))
Signature · 1 line
2.3.6
#1 lore raw

PATCH 1/1 autobuild-run: show options along with their defaults

Dear Andr? Erdmann,

Quoted 6 lines · Andr? Erdmann

Currently, the default values for options are printed at the end of the help message, so there is a visual distance between the "--<option>" help and its default value that increases with every newly introduced option.

Move them closer together by means of str-dict formatting, "%(key)s".

Quoted 7 lines

"[default: ]" cannot be used as it gets parsed by docopt, using "Defaults to ...", "Not set by default", ... phrases instead.

---
 scripts/autobuild-run | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com