Skip to content

Commit

Permalink
chore: Cleanup invocation of add_argument()
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Dec 18, 2024
1 parent 5983016 commit 01af43b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/gallia/cli/gallia.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def __call__(
sys.exit(exitcodes.OK)

parser.add_argument(
name if name.startswith("-") else f"--{name}",
name,
nargs=0,
action=Action,
help=help_,
Expand All @@ -188,20 +188,6 @@ def __call__(
sys.exit(get_command(config).entry_point())


def main() -> None:
gallia_commands = load_commands()
parse_and_run(
gallia_commands,
top_level_options={
"version": (version, "show version and exit"),
"show-plugins": (show_plugins, "show registered plugins"),
"show-config": (show_config, "show loaded config"),
"template": (template, "generate a annotated config template"),
},
show_help_on_zero_args=True,
)


def version() -> None:
"""
Prints the currently installed version of gallia.
Expand Down Expand Up @@ -324,5 +310,19 @@ def template() -> None:
print(output.strip())


def main() -> None:
gallia_commands = load_commands()
parse_and_run(
gallia_commands,
top_level_options={
"--version": (version, "show version and exit"),
"--show-plugins": (show_plugins, "show registered plugins"),
"--show-config": (show_config, "show loaded config"),
"--template": (template, "generate a annotated config template"),
},
show_help_on_zero_args=True,
)


if __name__ == "__main__":
main()

0 comments on commit 01af43b

Please sign in to comment.