diff --git a/pyaptly/cli.py b/pyaptly/cli.py index 89d8c1a..ed48e6e 100644 --- a/pyaptly/cli.py +++ b/pyaptly/cli.py @@ -19,12 +19,18 @@ def entry_point(): if len_argv > 0 and argv[0].endswith("pyaptly"): if len_argv > 2 and argv[1] == "legacy" and argv[2] != "--": argv = argv[:2] + ["--"] + argv[2:] + if "--debug" in argv or "-d" in argv: + debug = True + else: + debug = False try: cli.main(argv[1:]) except CalledProcessError: pass # already logged except Exception as e: + if debug: + raise from . import util path = util.write_traceback() @@ -160,6 +166,7 @@ def publish(**kwargs): @cli.command(help="convert yaml- to toml-comfig") +@click.option("--debug/--no-debug", "-d/-nd", default=False, type=bool) @click.argument( "yaml_path", type=click.Path( @@ -187,7 +194,7 @@ def publish(**kwargs): default=False, help="Add default values to fields if missing", ) -def yaml_to_toml(yaml_path: Path, toml_path: Path, add_defaults: bool): +def yaml_to_toml(yaml_path: Path, toml_path: Path, add_defaults: bool, debug: bool): """Convert pyaptly config files from yaml to toml.""" from . import config_file