Python Click package enables you to create CLI tools easily. With this, you can focus on core logic while Click does the flag parsing and validations.
Creating a command is as simple as:
import click @click.command() # Creates a click command @click.option( # Check out click's documentation to see all the options "--input", required=True, help = "Some input that you must provide", ) def cli(input): # The options becomes parameters to the method # You can now use input to do something print(f'Hello {input}') if __name__ == "__main__": # Name of this method doesn't matter. Command name is derived from # the file name. cli()
Click has good documentation. Have a look.