Skip to content

Conversation

brettviren
Copy link
Member

This PR cleans up two inter-related things: logging and the creation of the Click "group" object.

It provides a Python decorator for creating the Click cli function so that every wirecell-* command gets common command line options (for logging and help). It applies this to all the current __main__.py.

With this in place, all __main__.py and module code may use, eg, log.debug() instead of print(). This PR replaces print() with log methods in the __main__.py but there are still many print() sprinkled in the modules.

It also moves the some other Click-related decorators from plots.cli to util.cli and applies them to a few new commands.

Breaking: These new applications do change the command line option flags for some of the sub-commands. I figure having standardized calling patterns is worth the breakage. It's why I make this a PR instead of just pushing.

There are still more functions with nearly common option patterns and it would be good to further standardize. But, first let's see what problems (if any) this breaking change causes.

@HaiwangYu
Copy link
Member

Thanks @brettviren for making this update. I tested it with wirecell-img dump-blobs seems till working. Will merge it soon.

@HaiwangYu HaiwangYu merged commit 5fc7163 into master Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants