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
-
Documentation:
- Always provide docstrings for your parser class
- Use descriptive help messages for arguments
- Document the purpose of your
cli_run
method
-
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)
-
Defaults and Validation:
- Provide sensible defaults when possible
- Use choices for restricted options
- Handle missing or invalid input gracefully
-
Code Organization:
- Keep argument definitions clean and organized
- Group related arguments together
- Use type hints and docstrings for better code clarity