Skip to content

Commit

Permalink
Merge pull request #111 from adfinis/jlf/fix-show-stack-traces-in-deb…
Browse files Browse the repository at this point in the history
…ug-mode

fix: show stack traces in debug mode
  • Loading branch information
Jean-Louis Fuchs authored May 23, 2024
2 parents 308674e + 5d9d0df commit 8e18167
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pyaptly/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8e18167

Please sign in to comment.