CMDR is a simple command version management tool that helps you quickly switch from multiple command versions.
Full documentation is available at https://mrlyc.github.io/cmdr/
中文文档 (Chinese Documentation): https://www.zdoc.app/zh/MrLYC/cmdr?refresh=1770878793863
- Installation Guide - Get started with CMDR
- Quick Start - First steps tutorial
- Configuration - Configuration reference
- Architecture - System design and internals
- API Reference - Interface documentation
- Development Guide - Build, test, and contribute
Run one for the following command to install the latest version of CMDR:
curl -o- https://raw.githubusercontent.com/MrLYC/cmdr/master/install.sh | ${SHELL:-bash}For Chinese users, you can install the CMDR via a proxy:
curl -o- https://raw.githubusercontent.com/MrLYC/cmdr/master/install.sh | bash -s -p- Download the latest release from GitHub;
- Make sure the download asset is executable;
- Run the following command to install the binary:
/path/to/cmdr init
- Restart your shell and run the following command to verify the installation:
cmdr version
Note: The cmdr command xxx format is deprecated. Use cmdr xxx directly (e.g., cmdr install instead of cmdr command install).
To install a new command, run the following command:
cmdr install -n <command-name> -v <version> -l <path-or-url>Then you can list the installed commands by running the following command:
cmdr list -n <command-name>Use a specified command version:
cmdr use -n <command-name> -v <version>To upgrade the CMDR, just run:
cmdr upgradeSpeed up the download process by replacing the url to github proxy:
cmdr config set -k download.replace -v '{"match": "^https://raw.githubusercontent.com/.*$", "template": "https://ghproxy.com/{{ .input | urlquery }}"}'
cmdr install -n install.sh -v 0.0.0 -l https://raw.githubusercontent.com/MrLYC/cmdr/master/install.shCMDR uses go-getter for downloading commands, which supports multiple protocols:
Direct downloads from HTTP/HTTPS URLs:
cmdr install -n kubectl -v 1.28.0 -l https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectlClone from Git repositories with support for branches, tags, and commits:
# Clone repository
cmdr install -n script -v 1.0.0 -l git::https://github.com/user/repo.git
# Specific branch
cmdr install -n script -v 1.0.0 -l git::https://github.com/user/repo.git?ref=main
# Specific tag
cmdr install -n script -v 1.0.0 -l git::https://github.com/user/repo.git?ref=v1.0.0
# Specific commit
cmdr install -n script -v 1.0.0 -l git::https://github.com/user/repo.git?ref=abc123
# Sub-path in repository
cmdr install -n script -v 1.0.0 -l git::https://github.com/user/repo.git//scripts/install.shConvenient shortcuts for GitHub repositories:
# Short form for GitHub repositories (defaults to HTTPS)
cmdr install -n tool -v 1.0.0 -l github.com/user/repo
# With sub-path
cmdr install -n tool -v 1.0.0 -l github.com/user/repo//path/to/binaryAutomatically extracts various archive formats:
.tar.gz,.tgz- Gzip compressed tar archives.tar.bz2,.tbz2- Bzip2 compressed tar archives.tar.xz,.txz- XZ compressed tar archives.tar.zst,.tzst- Zstandard compressed tar archives.zip- ZIP archives.gz- Gzip compressed files.bz2- Bzip2 compressed files.xz- XZ compressed files.zst- Zstandard compressed files
# Automatically extracts tar.gz archive
cmdr install -n kubectl -v 1.28.0 -l https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl.tar.gz
# Select specific file from archive using // separator
cmdr install -n node -v 18.0.0 -l https://nodejs.org/dist/v18.0.0/node-v18.0.0-linux-x64.tar.gz//node-v18.0.0-linux-x64/bin/node
# Disable automatic extraction
cmdr install -n archive -v 1.0.0 -l https://example.com/file.tar.gz?archive=falseUse :: to force a specific protocol detector:
# Force Git protocol even if URL looks like HTTPS
cmdr install -n tool -v 1.0.0 -l git::https://example.com/tool.git
# Force HTTP protocol
cmdr install -n tool -v 1.0.0 -l http::example.com/toolDownload from Amazon S3 buckets:
# AWS S3 (various addressing schemes)
cmdr install -n tool -v 1.0.0 -l s3::https://s3.amazonaws.com/bucket/tool
cmdr install -n tool -v 1.0.0 -l s3::https://s3-eu-west-1.amazonaws.com/bucket/tool
# With credentials (prefer using AWS environment variables)
cmdr install -n tool -v 1.0.0 -l "s3::https://s3.amazonaws.com/bucket/tool?aws_access_key_id=KEYID&aws_access_key_secret=SECRET"Download from Google Cloud Storage:
# Google Cloud Storage
cmdr install -n tool -v 1.0.0 -l gcs::https://www.googleapis.com/storage/v1/bucket/foo.zipReference local files or directories:
# Relative path
cmdr install -n tool -v 1.0.0 -l ./path/to/binary
# Absolute path
cmdr install -n tool -v 1.0.0 -l /usr/local/bin/binary
# File URL
cmdr install -n tool -v 1.0.0 -l file:///path/to/binaryVerify downloads with checksums:
# Add checksum verification
cmdr install -n kubectl -v 1.28.0 -l "https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl?checksum=sha256:abc123..."
# Checksum file (automatically detected)
cmdr install -n tool -v 1.0.0 -l https://example.com/tool # Looks for tool.sha256, tool.sha256sum, etc.For more details and advanced options, see the go-getter documentation.