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

Added CLI #10

Merged
merged 5 commits into from
May 19, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added show command.
WyvernIXTL committed May 19, 2024
commit e3c8b4158e1014fca9061cc0707c5757769947cb
15 changes: 10 additions & 5 deletions installation_instruction/__main__.py
Original file line number Diff line number Diff line change
@@ -26,14 +26,14 @@ def __init__(self, *args, **kwargs):
super().__init__(
*args,
**kwargs,
subcommand_metavar="CONFIG [OPTIONS]...",
subcommand_metavar="CONFIG_FILE [OPTIONS]...",
options_metavar="",
)

def get_command(self, ctx, config_file: str) -> click.Command:
def get_command(self, ctx, config_file: str) -> click.Command|None:
if not isfile(config_file):
print("Config file not found.")
exit(1)
click.echo("Config file not found.")
return None

instruction = InstallationInstruction.from_file(config_file)
options = get_flags_and_options(instruction.schema)
@@ -54,10 +54,15 @@ def callback(**kwargs):
)


@click.command(cls=ConfigReadCommand)
@click.command(cls=ConfigReadCommand, help="Shows installation instructions for your specified config file and parameters.")
def show():
pass

@click.group()
def main():
pass

main.add_command(show)

if __name__ == "__main__":
main()