lib.App: Fix --help with required top-level args #65
1 changed files with 10 additions and 5 deletions
|
|
@ -229,11 +229,16 @@ class App: # export
|
||||||
)
|
)
|
||||||
self._add_arguments(self.__parser)
|
self._add_arguments(self.__parser)
|
||||||
|
|
||||||
args, _ = self.__parser.parse_known_args(argv)
|
if not add_all_parsers:
|
||||||
set_log_flags(args.log_flags)
|
# Parse known args and configure logging, but only if we're not on
|
||||||
set_log_level(args.log_level)
|
# an interactive usage mission. The problem with parse_known_args()
|
||||||
|
# is that it fails over missing but required arguments, and we
|
||||||
log(DEBUG, f'-------------- Running: >{pretty_cmd(cmdline)}<')
|
# don't want that to happen and never get to the point where
|
||||||
|
# '--help' is registered.
|
||||||
|
args, _ = self.__parser.parse_known_args(argv)
|
||||||
|
set_log_flags(args.log_flags)
|
||||||
|
set_log_level(args.log_level)
|
||||||
|
log(DEBUG, f'-------------- Running: >{pretty_cmd(cmdline)}<')
|
||||||
|
|
||||||
add_cmds_to_parser(self, self.__parser, self.__cmds, all = add_all_parsers)
|
add_cmds_to_parser(self, self.__parser, self.__cmds, all = add_all_parsers)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue