diff --git a/arbejdstimer/cli.py b/arbejdstimer/cli.py index c8966229..428d4049 100644 --- a/arbejdstimer/cli.py +++ b/arbejdstimer/cli.py @@ -97,6 +97,16 @@ def now( return sys.exit(at.main(action)) +def explain_enforce_defaults(conf: str = '', verbose: bool = False) -> int: + """Until the root cause of https://github.com/tiangolo/typer/issues/106 remains unfixed.""" + command = 'explain' + if verbose: + command += '_verbatim' + config = conf if conf else pathlib.Path.home() / at.DEFAULT_CONFIG_NAME + action = [command, str(config)] + return sys.exit(at.main(action)) + + @app.command('explain') def explain( conf: str = typer.Option( @@ -118,12 +128,7 @@ def explain( Explain the answer to the question if now is a working hour (in addition to the return code 0 for yes, and 1 for no). """ - command = 'explain' - if verbose: - command += '_verbatim' - config = conf if conf else pathlib.Path.home() / at.DEFAULT_CONFIG_NAME - action = [command, str(config)] - return sys.exit(at.main(action)) + return explain_enforce_defaults(conf, verbose) @app.command('version')