mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
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).
This commit is contained in:
parent
aac7a34405
commit
6ee689345f
2 changed files with 9 additions and 1 deletions
|
@ -832,7 +832,7 @@ def add_global_options(parser):
|
||||||
group = parser.add_argument_group('global options')
|
group = parser.add_argument_group('global options')
|
||||||
# const is for when no argument is given to verbosity
|
# const is for when no argument is given to verbosity
|
||||||
# default is for when the flag is missing
|
# 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("-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("-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")
|
group.add_argument("-w", "--wallet", dest="wallet_path", help="wallet path")
|
||||||
|
|
|
@ -335,6 +335,14 @@ if __name__ == '__main__':
|
||||||
sys.argv.remove('help')
|
sys.argv.remove('help')
|
||||||
sys.argv.append('-h')
|
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
|
# read arguments from stdin pipe and prompt
|
||||||
for i, arg in enumerate(sys.argv):
|
for i, arg in enumerate(sys.argv):
|
||||||
if arg == '-':
|
if arg == '-':
|
||||||
|
|
Loading…
Add table
Reference in a new issue