Skip to content

Commit

Permalink
Ensure --progress goes to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
dspinellis committed Jul 2, 2024
1 parent 8be5db4 commit b5aa6c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/alexandria3k/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ def get_cli_parser():
type=str,
default=[],
# NOTE: Keep in sync with list in debug.py
# Exceptions:
# stderr does not work as a Debug API flag (use Debug.set_output)
# progress_bar is an undocumented CLI --debug option (use --progress)
help="""Output debuggging information according to the comma-separated arguments.
files-read: Counts of Crossref data files read;
link: Record linking operations;
Expand Down Expand Up @@ -591,6 +594,7 @@ def error_raising_main():
sys.exit(0)

if args.progress:
debug.set_output(sys.stderr)
debug.set_flags(["progress_bar"])

# Handle subcommands
Expand Down
4 changes: 3 additions & 1 deletion src/alexandria3k/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def get_output():


# NOTE: Keep in sync with list in __main__.py
# Exceptions:
# stderr does not work as a Debug API flag (use Debug.set_output)
# progress_bar is an undocumented CLI --debug option (use --progress)
def set_flags(flags):
"""
Enable the specified debug flags.
Expand All @@ -71,7 +74,6 @@ def set_flags(flags):
* progress: Report population progress;
* progress_bar: Display a progress bar; (enabled through --progress)
* sorted-tables: Topologically ordered Crossref query tables;
* stderr: Log to standard error;
:param flags: Flags to enable.
:type flags: list
Expand Down

0 comments on commit b5aa6c8

Please sign in to comment.