CLI Commands¶
This document details all CLI commands available in CMDR.
Root Command¶
Global Flags¶
| Flag | Short | Description |
|---|---|---|
--config |
-c |
Path to config file (default: ~/.cmdr/config.yaml) |
--help |
-h |
Help for cmdr |
Command Management¶
cmdr install¶
Install a new command version into CMDR.
Note: The old format cmdr command install is deprecated. Use cmdr install instead.
Flags:
| Flag | Short | Required | Description |
|---|---|---|---|
--name |
-n |
Yes | Command name |
--version |
-v |
Yes | Version string |
--location |
-l |
Yes | URL or file path to the binary |
--activate |
-a |
No | Activate immediately after install |
Source: cmd/command/install.go1
Example:
# Install kubectl 1.28.0 from URL
cmdr install -n kubectl -v 1.28.0 -l https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl
# Install and activate immediately
cmdr install -n kubectl -v 1.28.0 -l /path/to/kubectl -a
cmdr use¶
Activate a specific version of a command.
Note: The old format cmdr command use is deprecated. Use cmdr use instead.
Flags:
| Flag | Short | Required | Description |
|---|---|---|---|
--name |
-n |
Yes | Command name |
--version |
-v |
Yes | Version to activate |
Source: cmd/command/use.go2
Example:
cmdr list¶
List installed command versions.
Note: The old format cmdr command list is deprecated. Use cmdr list instead.
Flags:
| Flag | Short | Description |
|---|---|---|
--name |
-n |
Filter by command name |
--version |
-v |
Filter by version |
--activate |
-a |
Show only activated commands |
Source: cmd/command/list.go
Example:
# List all commands
cmdr list
# List all versions of kubectl
cmdr list -n kubectl
# List only activated commands
cmdr list -a
cmdr remove¶
Remove a command version.
Note: The old format cmdr command remove is deprecated. Use cmdr remove instead.
Flags:
| Flag | Short | Required | Description |
|---|---|---|---|
--name |
-n |
Yes | Command name |
--version |
-v |
Yes | Version to remove |
Source: cmd/command/remove.go
cmdr unset¶
Deactivate a command (remove from shims).
Note: The old format cmdr command unset is deprecated. Use cmdr unset instead.
Source: cmd/command/unset.go
cmdr define¶
Define a command without downloading (for local binaries).
Note: The old format cmdr command define is deprecated. Use cmdr define instead.
Source: cmd/command/define.go
Configuration Management¶
cmdr config list¶
List all configuration values.
Source: cmd/config/list.go
cmdr config get¶
Get a specific configuration value.
Source: cmd/config/get.go
cmdr config set¶
Set a configuration value.
Source: cmd/config/set.go
Example:
# Set log level
cmdr config set -k log.level -v debug
# Set URL replacement for proxy
cmdr config set -k download.replace -v '{"match": "...", "template": "..."}'
System Commands¶
cmdr clean¶
Clean old inactive command versions.
This command: - Groups versions by command name - Sorts inactive versions by added time (based on shim file mtime) - Keeps the newest inactive versions (default: 3) - Moves versions older than a threshold (default: 100 days) into a trash directory
Flags:
| Flag | Required | Description |
|---|---|---|
--name / -n |
No | Only clean specified command name(s). Can be repeated. If any specified name does not exist, the command fails. |
--age |
No | Only clean versions older than this many days (default: 100) |
--keep |
No | Keep this many newest inactive versions per command (default: 3) |
Trash directory:
- macOS: ~/.Trash/cmdr-cleaned
- Linux: /tmp/cmdr-cleaned
Source: cmd/clean.go
cmdr init¶
Initialize CMDR environment.
This command:
1. Creates directory structure (bin/, shims/, profile/)
2. Generates shell profile scripts
3. Registers CMDR itself as a managed command
Source: cmd/init.go
cmdr upgrade¶
Upgrade CMDR to the latest version.
Flags:
| Flag | Short | Description |
|---|---|---|
--release |
-r |
Specific release name (default: latest) |
--asset |
-a |
Specific asset name |
Source: cmd/upgrade.go
cmdr doctor¶
Diagnose CMDR installation issues.
Checks for: - Directory structure integrity - Database accessibility - Shell profile configuration - PATH configuration
Source: cmd/doctor.go
cmdr version¶
Display CMDR version information.
Source: cmd/version.go
Command Structure¶
cmdr
├── clean # Clean old inactive versions
├── command
│ ├── define # Define command from local path
│ ├── install # Install command from URL/path
│ ├── list # List installed commands
│ ├── remove # Remove a command version
│ ├── unset # Deactivate a command
│ └── use # Activate a command version
├── config
│ ├── get # Get config value
│ ├── list # List all config
│ └── set # Set config value
├── doctor # Diagnose issues
├── init # Initialize CMDR
├── upgrade # Upgrade CMDR
└── version # Show version
-
Install command implementation in
cmd/command/install.goL12-L37 ↩ -
Use command implementation in
cmd/command/use.goL12-L32 ↩