commit 6ee689345fdba24fddf0a719e906fed406e0d448
parent aac7a34405575a238964d6e429ebaf90ecd03fc6
Author: SomberNight <somber.night@protonmail.com>
Date: Thu, 30 Aug 2018 18:34:04 +0200
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).
Diffstat:
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git 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
@@ -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 == '-':