Skip to content

Kitchen dump

Next Steps

After mastering these basics, you can explore more advanced features of Clak:

  • Subcommands for complex applications
  • Custom argument types and validation
  • Error handling and user feedback
  • Configuration file integration
  • And more!

Remember that Clak is built on top of Python's argparse, so you can leverage all its features while enjoying a more elegant, class-based interface.

Best Practices

  1. Documentation:

    • Always provide docstrings for your parser class
    • Use descriptive help messages for arguments
    • Document the purpose of your cli_run method
  2. Argument Names:

    • Use meaningful names for arguments
    • Provide both long and short forms for optional arguments
    • Follow command-line conventions (e.g., lowercase for options)
  3. Defaults and Validation:

    • Provide sensible defaults when possible
    • Use choices for restricted options
    • Handle missing or invalid input gracefully
  4. Code Organization:

    • Keep argument definitions clean and organized
    • Group related arguments together
    • Use type hints and docstrings for better code clarity