Easily manage multiple Cloud Foundry API targets with seamless switching and saving.
This plugin simplifies working with multiple CF environments by allowing you to save, switch, and manage different API targets effortlessly. Perfect for developers working across development, staging, and production environments.
- Save Multiple Targets: Store unlimited CF API targets with custom names
- Quick Switching: Switch between environments with a single command
- Smart Diff Display: See exactly what changes when switching targets
- Cross-Platform: Works on Linux, macOS, and Windows (Intel & ARM)
- Secure: Redacts sensitive tokens in diff output
- Easy Installation: One-command npm installation with automatic CF CLI registration
npm install -g @cf-plugins/cf-targets-plugincf api https://api.your-dev-environment.com
cf login
cf save-target developmentcf api https://api.your-prod-environment.com
cf login
cf save-target productioncf set-target development
cf set-target productionThat's it! You're now managing multiple CF environments like a pro.
# Save with a custom name
cf save-target my-dev-env
# Update existing target (with confirmation)
cf save-target production -f# Switch to saved target
cf set-target production
# Force switch (discards unsaved changes)
cf set-target development -fcf targetsOutput:
development
production (current)
staging
cf delete-target old-environment| Command | Usage | Description |
|---|---|---|
targets |
cf targets |
List all saved targets |
save-target |
cf save-target [-f] [NAME] |
Save current target |
set-target |
cf set-target [-f] NAME |
Switch to saved target |
delete-target |
cf delete-target NAME |
Delete saved target |
-f, --force: Override confirmations and force the operation
npm install -g @cf-plugins/cf-targets-pluginThe plugin automatically registers with CF CLI during installation.
- Download binary from Releases
- Make executable:
chmod +x cf-targets-plugin-* - Install:
cf install-plugin /path/to/binary -f
git clone https://github.com/Amit-A2Z/cf-targets-plugin.git
cd cf-targets-plugin
make build
cf install-plugin cf-targets-plugin -f# Check if plugin is installed
cf plugins | grep cf-targets
# If not found, manually register
cf install-plugin ~/.nvm/versions/node/*/lib/node_modules/@cf-plugins/cf-targets-plugin/bin/cf-targets-plugin -f
# Verify installation
cf plugins# Make binary executable
chmod +x ~/.nvm/versions/node/*/lib/node_modules/@cf-plugins/cf-targets-plugin/bin/cf-targets-plugin- Install CF CLI: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
- Reinstall plugin:
npm install -g @cf-plugins/cf-targets-plugin
- Go 1.25 or later
- Cloud Foundry CLI
# Build for current platform
make build
# Build for all platforms
make release-all
# Install locally
make install| Platform | Architecture | Status |
|---|---|---|
| Linux | AMD64 | β Supported |
| Linux | ARM64 | β Supported |
| macOS | Intel (AMD64) | β Supported |
| macOS | Apple Silicon (ARM64) | β Supported |
| Windows | AMD64 | β Supported |
| Windows | ARM64 | β Supported |
Contributions are welcome! Please feel free to submit issues and pull requests.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Note: This software is provided "AS IS" without warranty of any kind. Use at your own discretion.
Need help? Check out the Issues page or create a new issue for support.