Commands Reference¶
Complete reference for all available CLI commands and their options.
Root Command¶
cli-template¶
The main entry point for the CLI application.
1 2 | |
Global Flags: - -h, --help: Show help information - -v, --version: Display version information
Available Commands: - hello: Print a greeting message - completion: Generate shell completion scripts - help: Show help for any command
Commands¶
hello¶
Print a greeting message with optional customization.
1 | |
Usage Examples:
1 2 3 4 5 6 | |
Flags: - -n, --name string: Name to greet (default: "World") - -h, --help: Help for hello command
completion¶
Generate shell completion scripts for various shells.
1 | |
Usage Examples:
1 2 3 4 5 6 7 8 9 10 11 | |
Exit Codes¶
The CLI application uses standard exit codes:
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid usage/arguments |
| 130 | Interrupted by user (Ctrl+C) |
Environment Variables¶
Configuration¶
CONFIG_PATH: Path to configuration fileLOG_LEVEL: Logging level (debug, info, warn, error)DEBUG: Enable debug mode (true/false)
Build Information¶
These are set at build time: - VERSION: Application version - COMMIT: Git commit hash - BUILD_DATE: Build timestamp
Global Configuration¶
Config File Locations¶
The CLI looks for configuration files in:
- Current directory:
./cli-template.yaml - Home directory:
~/.cli-template.yaml - System config:
/etc/cli-template/config.yaml
Configuration Format¶
1 2 3 4 5 6 7 8 9 | |
Advanced Usage¶
Shell Integration¶
Bash¶
Add to ~/.bashrc:
1 2 3 4 5 | |
Zsh¶
Add to ~/.zshrc:
1 2 3 4 5 6 | |
Fish¶
Add to ~/.config/fish/config.fish:
1 2 3 4 5 | |
Scripting¶
Use in shell scripts:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
JSON Output¶
Enable JSON output for programmatic use:
1 2 | |
Output:
1 2 3 4 5 | |