Browse Source

fix -v syntax

After the introduction of arguments for -v, it would sometimes incorrectly consume the CLI cmd as its argument.
This change keeps the old "-v" syntax working, at the cost of having to provide the arguments without a whitespace directly after -v (and the args need to be single letters).
3.2.x
SomberNight 6 years ago
parent
commit
6ee689345f
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/commands.py
  2. 8
      run_electrum

2
electrum/commands.py

@ -832,7 +832,7 @@ def add_global_options(parser):
group = parser.add_argument_group('global options')
# const is for when no argument is given to verbosity
# default is for when the flag is missing
group.add_argument("-v", "--verbosity", dest="verbosity", help="Set verbosity filter", default='', const='*', nargs='?')
group.add_argument("-v", dest="verbosity", help="Set verbosity filter", default='', const='*', nargs='?')
group.add_argument("-D", "--dir", dest="electrum_path", help="electrum directory")
group.add_argument("-P", "--portable", action="store_true", dest="portable", default=False, help="Use local 'electrum_data' directory")
group.add_argument("-w", "--wallet", dest="wallet_path", help="wallet path")

8
run_electrum

@ -335,6 +335,14 @@ if __name__ == '__main__':
sys.argv.remove('help')
sys.argv.append('-h')
# old '-v' syntax
try:
i = sys.argv.index('-v')
except ValueError:
pass
else:
sys.argv[i] = '-v*'
# read arguments from stdin pipe and prompt
for i, arg in enumerate(sys.argv):
if arg == '-':

Loading…
Cancel
Save