I would like to create a CLI that receives an action and resource parameters to work, in a kubectl fashion. Eg.
myctl init config
myctl create issue|pr|branch
myctl delete issue|pr|branch|config
myctl command should always receive 2 arguments, so that the user wouldn't try something like: myctl init config delete issue. Also the should not be able to execute impossible combinations such as myctl create config.
I though of some code like:
import click
@click.command()
@click.group()
@click.option(
"init,create,delete",
type=str,
help="Action name.",
)
@click.option(
"config,issue,pr,branch",
type=str,
help="Resource name.",
)
def main(action: str, resource: str) -> None:
pass
if __name__ == "__main__":
main(prog_name="myctl")
I am not really sure what click elements should I use in order to structure that (arguments, options, groups, etc) and how to put that together.