diff options
author | Gary E. Miller <gem@rellim.com> | 2019-04-25 14:20:38 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2019-04-25 14:20:38 -0700 |
commit | a94128d8a28ff2cab5d045d4396d4d0a821724fc (patch) | |
tree | f4d6e84c2dcc2943c032d2f1cccaae35b295a0ec /ubxtool | |
parent | 1f8e94bef120b0b96d3a4632366f828633de28b6 (diff) | |
download | gpsd-a94128d8a28ff2cab5d045d4396d4d0a821724fc.tar.gz |
ubxtool: Be less verbose with default -h. Use -v to increase -h.
Diffstat (limited to 'ubxtool')
-rwxr-xr-x | ubxtool | 29 |
1 files changed, 19 insertions, 10 deletions
@@ -78,6 +78,8 @@ opts = { 'disable': None, # command for -e enable 'enable': None, + # help requested + 'help': None, # default input -f file 'input_file_name': None, # default -g item @@ -4448,7 +4450,7 @@ def usage(): ' -f F open F as file/device\n' ' default: %s\n' ' -g G get config item G\n' - ' -h print help\n' + ' -h print help, increase -v for extra help\n' ' -i I interface (port) for UBX-CFG-PRT\n' ' -m M optional mode to -p P\n' ' -P P Protocol version for sending commands\n' @@ -4468,21 +4470,25 @@ def usage(): ' -x X delete config item X\n' ' -z Z,z set config item Z to z\n' ' -? print help\n' - '\n' - 'D and E can be one of:' % + '\n' % (PROG_NAME, opts['input_file_name'], opts['protver'], opts['raw_file'], opts['input_speed'], opts['input_wait'], opts['verbosity']) ) - for item in sorted(gps_model.able_commands.keys()): - print(" %-13s %s" % (item, gps_model.able_commands[item]["help"])) + if VERB_DECODE <= opts['verbosity']: + print('D and E can be one of:') + for item in sorted(gps_model.able_commands.keys()): + print(" %-13s %s" % + (item, gps_model.able_commands[item]["help"])) - print('\nP can be one of:') - for item in sorted(gps_model.commands.keys()): - print(" %-13s %s" % (item, gps_model.commands[item]["help"])) - print('\nOptions can be placed in the UBXOPTS environment variable.\n' + print('\nP can be one of:') + for item in sorted(gps_model.commands.keys()): + print(" %-13s %s" % (item, gps_model.commands[item]["help"])) + print('\n') + + print('Options can be placed in the UBXOPTS environment variable.\n' 'UBXOPTS is processed before the CLI options.') sys.exit(0) @@ -4517,7 +4523,7 @@ for (opt, val) in options: elif opt == '-g': opts['get_item'] = val elif opt == '-h' or opt == '-?': - usage() + opts['help'] = True elif opt == '-i': valnum = gps_model.port_id_map.get(val.upper()) opts['interface'] = valnum if valnum is not None else int(val) @@ -4563,6 +4569,9 @@ for (opt, val) in options: elif opt == '-z': opts['set_item'] = val +if opts['help']: + usage() + if opts['input_file_name'] is None: # no input file given # default to local gpsd |