0

I'm using click to build a command line interface for my python code.

The command is now becoming too complex and I'd like to split it into sub-commands. The interface I'm trying to obtain is something like:

mytool subcommand1 --option1 --option2
mytool subcommand2 arg1 --option1
1
  • Can you provide more information? What have you tried, where are you stuck? Commented Sep 27, 2020 at 18:27

1 Answer 1

2

Make a group out of an entry function cli:


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

@cli.group()
def subcommand1():
    #your code

@cli.group()
def subcommand2():
    #your code

Note it is important to use the decorator @cli.group() before the subcommands.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.