From 6ee689345fdba24fddf0a719e906fed406e0d448 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 30 Aug 2018 18:34:04 +0200 Subject: [PATCH] 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). --- electrum/commands.py | 2 +- run_electrum | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/electrum/commands.py b/electrum/commands.py index 7a9c0857a..e2cf87a26 100644 --- a/electrum/commands.py +++ b/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") diff --git a/run_electrum b/run_electrum index 46654ec1f..dd35c3516 100755 --- a/run_electrum +++ b/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 == '-':