A command-line utility to easily switch between different versions of the Hasura DDN CLI, similar to tfswitch
for Terraform.
Deepwiki docs link - https://deepwiki.com/shukla2112/ddnswitch/2.1-version-management-engine
- π Easy Version Switching: Switch between DDN CLI versions with a simple command
- π Interactive Selection: Choose from available versions using an interactive menu
- π¦ Automatic Installation: Downloads and installs DDN CLI versions on demand
- ποΈ Version Management: List, install, and uninstall specific versions
- π Smart Linking: Automatically creates symlinks or copies binaries to PATH
- π₯οΈ Cross-Platform: Works on Linux, macOS, and Windows
- β‘ Fast: Caches downloaded versions locally for quick switching
- π Permission-Aware: Falls back to user directories when system directories aren't writable
git clone https://github.com/yourusername/ddnswitch.git
cd ddnswitch
make build
make install-user # Installs to ~/bin
go install github.com/yourusername/ddnswitch@latest
Simply run ddnswitch
without arguments to see an interactive menu:
ddnswitch
To include pre-release versions:
ddnswitch --pre
This will:
- Fetch available DDN CLI versions
- Show an interactive selection menu
- Download and install the selected version (if not already cached)
- Switch your active DDN CLI to the selected version
Switch to a specific version directly:
ddnswitch v3.0.1
ddnswitch list
To include pre-release versions:
ddnswitch list --pre
ddnswitch install v3.0.1
ddnswitch current
ddnswitch uninstall v3.0.1
ddnswitch version
For troubleshooting, you can enable debug mode to see detailed logging:
ddnswitch --debug list
This will show additional information about:
- Network requests
- Cache operations
- Version detection
- Installation steps
- Version Discovery: DDNSwitch fetches available DDN CLI versions
- Local Storage: Downloaded versions are stored in
~/.ddnswitch/
directory - Path Management: Creates symlinks or copies the selected binary to a directory in your PATH
- Caching: Once downloaded, versions are cached locally for fast switching
- Permission Handling: Automatically falls back to user directories when system directories aren't writable
~/.ddnswitch/
βββ v3.0.1/
β βββ ddn
βββ v3.0.0/
β βββ ddn
βββ v2.9.0/
βββ ddn
- Go 1.21+ (for building from source)
- Internet connection (for downloading DDN CLI versions)
- Write access to a directory in your PATH (or ~/bin will be created)
DDNSwitch works out of the box with no configuration required. It will:
- Create
~/.ddnswitch/
directory for storing DDN CLI versions - Try to create symlinks in the first writable directory found in your PATH
- Fall back to
~/bin
if no suitable directory is found in PATH
DDNSwitch supports the following platforms:
- Linux: x86_64 (ARM-based Linux is not supported)
- macOS: x86_64 (Intel), arm64 (Apple Silicon)
- Windows: x86_64
go mod tidy
make build
make build-all
make build
- Build for current platformmake build-all
- Build for all supported platformsmake install
- Install to/usr/local/bin
make install-user
- Install to~/bin
make clean
- Remove build artifactsmake test
- Run testsmake check
- Run all code checks (format, vet, test)
Make sure the installation directory is in your PATH:
# For ~/bin installation
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
DDNSwitch will automatically try to find a writable directory in your PATH. If it can't find one, it will:
- Create
~/bin
directory - Install the binary there
- Notify you to add this directory to your PATH
This means the DDN CLI doesn't have a release for your platform. DDNSwitch supports:
- Linux (x86_64)
- macOS (Intel and Apple Silicon)
- Windows (x86_64)
Note that ARM-based Linux systems are not currently supported.
DDNSwitch requires internet access to:
- Fetch the list of available versions
- Download DDN CLI releases
If you're behind a proxy or firewall, ensure your Go environment is configured correctly.
DDNSwitch caches the list of available versions for 1 hour to improve performance. The first fetch might take a few seconds, but subsequent operations will be much faster.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by tfswitch for Terraform
- Built for the Hasura DDN CLI