Skip to content
Cloud Foundry CLI plugin to manage multiple targets
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Godeps
bin Add binaries for plugin repo Oct 3, 2017
vendor Update vendored versions Feb 4, 2017
.gitignore
.travis.yml
LICENSE
README.md
build-all.sh
cf_targets.go
cf_targets_suite_test.go A test Jul 1, 2015
cf_targets_test.go Upgrade godep and fixes for new cli Feb 4, 2017
repo-index.yml Updated to latest build scripts Aug 14, 2015

README.md

CF Targets Plugin

Build Status

This plugin facilitates the use of multiple api targets with the Cloud Foundry CLI.

It originated from the need for a Go play project, and the realization that I was frequently switching back and forth between development and various test environments, using tricks like

CF_HOME=~/cf-development cf push my-app
CF_HOME=~/cf-production cf push my-app

This plugin makes switching a lot less painful by allowing you to save your currently configured target using a name, then switching back to it by name at any point.

Usage

Configure and save any number of named targets

$ cf api <development-target-url>
$ cf login
...
$ cf save-target development

Followed by

$ cf api <production-target-url>
$ cf login
...
$ cf save-target production

After saving targets, easily switch back and forth between them using:

$ cf set-target development
$ cf target
API Endpoint:   <development-target-url>
...
$ cf set-target production
$ cf target
API Endpoint:   <production-target-url>
...

View saved targets using

$ cf targets
development
production (current)

Installation

Install from CLI
$ cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org/
$ cf install-plugin Targets -r CF-Community
Install from Source (need to have Go installed)
$ go get github.com/cloudfoundry/cli
$ go get github.com/guidowb/cf-targets-plugin
$ cd $GOPATH/src/github.com/guidowb/cf-targets-plugin
$ go build
$ cf install-plugin cf-targets-plugin

Full Command List

command usage description
targets cf targets list all saved targets
save-target cf save-target [-f] [<name>] save the current target for later use
set-target cf set-target [-f] <name> restore a previously saved target
delete-target cf delete-target <name> delete a previously saved target
You can’t perform that action at this time.