Allow --verbose or -vvv for any subcommand as well as at the top level.

This commit is contained in:
Chris Berkhout 2021-07-16 11:52:57 +02:00
parent 73c5f3a1c6
commit b00bca3903

View file

@ -130,6 +130,7 @@ def build_parser():
)
parser.add_argument(
"-vvv",
"--verbose",
action="store_true",
help="show all log messages",
@ -137,11 +138,17 @@ def build_parser():
subparsers = parser.add_subparsers(title="commands", dest="command")
subparsers.add_parser(
sources_parser = subparsers.add_parser(
"sources",
help="list sources",
formatter_class=formatter,
)
sources_parser.add_argument(
"-vvv",
"--verbose",
action="store_true",
help="show all log messages",
)
source_parser = subparsers.add_parser(
"source",
@ -156,6 +163,12 @@ def build_parser():
choices=sources.by_id.keys(),
help="the source identifier",
)
source_parser.add_argument(
"-vvv",
"--verbose",
action="store_true",
help="show all log messages",
)
source_list_or_search = source_parser.add_mutually_exclusive_group(required=False)
source_list_or_search.add_argument(
@ -177,7 +190,7 @@ def build_parser():
usage=(
# Set usage manually to have positional arguments before options
# and show allowed values where appropriate
"pricehist fetch SOURCE PAIR [-h] "
"pricehist fetch SOURCE PAIR [-h] [-vvv] "
"[-t TYPE] [-s DATE | -sx DATE] [-e DATE | -ex DATE] "
f"[-o {'|'.join(outputs.by_type.keys())}] "
"[--invert] [--quantize INT] "
@ -201,6 +214,12 @@ def build_parser():
type=valid_pair,
help="pair, usually BASE/QUOTE, e.g. BTC/USD",
)
fetch_parser.add_argument(
"-vvv",
"--verbose",
action="store_true",
help="show all log messages",
)
fetch_parser.add_argument(
"-t",
"--type",