Command Groups
Command groups help organize related commands together for better usability and maintainability.
Group Structure
CLI Utils uses a hierarchical command structure:
Example:
Categories
Local Commands
Commands that run locally on your machine:
- File operations
- Text processing
- System utilities
- Data manipulation
Path: src/cli_utils/commands/local/<group>/
Remote Commands
Commands that interact with remote APIs:
- API calls
- Web scraping
- Cloud service management
- Data fetching
Path: src/cli_utils/commands/remote/<group>/
Creating a New Group
- Create a directory under the appropriate category:
- Add an
__init__.pyfile:
- Add command files:
touch src/cli_utils/commands/local/my_new_group/command1.py
touch src/cli_utils/commands/local/my_new_group/command2.py
That's it! The group is automatically discovered and available via CLI.
Example Groups
Text Utils (text_utils)
Text manipulation commands:
cli-utils local text-utils uppercase "text"
cli-utils local text-utils lowercase "TEXT"
cli-utils local text-utils titlecase "text"
File Operations (file_ops)
File manipulation commands (to be implemented):
System Info (system_info)
System information commands (to be implemented):
Group Naming Conventions
- Use lowercase with underscores:
text_utils,file_ops - CLI automatically converts to kebab-case:
text-utils,file-ops - Choose descriptive, functional names
- Keep group names concise but clear
Group Organization Tips
- Logical grouping: Group commands by functionality, not implementation
- Flat is better: Avoid deep nesting; keep it at 3 levels maximum
- Single responsibility: Each group should have a clear, focused purpose
- Reasonable size: Aim for 5-15 commands per group
Next Steps
- Learn how to Add Commands
- Check out Examples