Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortform aliases #1713

Merged
merged 2 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions ctapipe/core/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,20 @@ def __init__(self, **kwargs):
# make sure there are some default aliases in all Tools:
super().__init__(**kwargs)
aliases = {
"config": "Tool.config_file",
("c", "config"): "Tool.config_file",
"log-level": "Tool.log_level",
("l", "log-file"): "Tool.log_file",
"log-file-level": "Tool.log_file_level",
}
self.aliases.update(aliases)
# makes sure user defined aliases override default aliases
self.aliases = {**aliases, **self.aliases}

flags = {
("q", "quiet"): ({"Tool": {"quiet": True}}, "Disable console logging.")
("q", "quiet"): ({"Tool": {"quiet": True}}, "Disable console logging."),
("v", "verbose"): (
{"Tool": {"log_level": "DEBUG"}},
"Set log level to DEBUG",
),
}
self.flags.update(flags)

Expand Down
10 changes: 5 additions & 5 deletions ctapipe/tools/stage1.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class Stage1Tool(Tool):
progress_bar = Bool(help="show progress bar during processing").tag(config=True)

aliases = {
"input": "EventSource.input_url",
"output": "DL1Writer.output_path",
"allowed-tels": "EventSource.allowed_tels",
"max-events": "EventSource.max_events",
("i", "input"): "EventSource.input_url",
("o", "output"): "DL1Writer.output_path",
("t", "allowed-tels"): "EventSource.allowed_tels",
("m", "max-events"): "EventSource.max_events",
"image-cleaner-type": "ImageProcessor.image_cleaner_type",
}

Expand All @@ -56,7 +56,7 @@ class Stage1Tool(Tool):
{"DL1Writer": {"write_index_tables": True}},
"generate PyTables index tables for the parameter and image datasets",
),
"overwrite": (
("f", "overwrite"): (
kosack marked this conversation as resolved.
Show resolved Hide resolved
{"DL1Writer": {"overwrite": True}},
"Overwrite output file if it exists",
),
Expand Down