diff --git a/plugins/cloudfoundry/README.md b/plugins/cloudfoundry/README.md new file mode 100644 index 000000000..89dd9d1ce --- /dev/null +++ b/plugins/cloudfoundry/README.md @@ -0,0 +1,58 @@ +# Cloudfoundry Plugin + +This plugin is intended to offer a few simple aliases for regular users of the [Cloud Foundry Cli][1]. Most are just simple aliases that will save a bit of typing. Others include mini functions and or accept parameters. Take a look at the table below for details. + +| Alias | Command | Description | +|----------|-----------------------------|--------------------------------------------------------------------------| +| cfl | `cf login` | Login to Cloud Foundry | +| cft | `cf target` | Target the cli at a specific Org/Space in Cloud Foundry | +| cfa | `cf apps` | List all applications in the current Org/Space | +| cfs | `cf services` | List all services in the current Org/Space | +| cfm | `cf marketplace` | List the services available in the Marketplace | +| cfp | `cf push` | Push your application code to Cloud Foundry | +| cfcs | `cf create-service` | Create a service based on a Marketplace offering | +| cfbs | `cf bind-service` | Bind an application to a service you created | +| cfus | `cf unbind-service` | Unbind a service from an application | +| cfds | `cf delete-service` | Delete a service you no longer have bound | +| cfup | `cf cups` | Create a "user-provided-service" | +| cflg | `cf logs` | Tail the logs of an application (requires ) | +| cfr | `cf routes` | List all the routes in the current Space | +| cfe | `cf env` | Show the environment variables for an application (requires ) | +| cfsh | `cf ssh` | Attach to a running container (requires an etc.) | +| cfsc | `cf scale` | Scale an application (requires an etc.) | +| cfev | `cf events` | Show the application events (requires ) | +| cfdor | `cf delete-orphaned-routes` | Delete routes that are no longer bound to applications | +| cfbpk | `cf buildpacks` | List the available buildpacks | +| cfdm | `cf domains` | List the domains associates with this Cloud Foundry foundation | +| cfsp | `cf spaces` | List all the Spaces in the current Org | +| cfap | `cf app` | Show the details of a deployed application (requires ) | +| cfh. | `export CF_HOME=$PWD/.cf` | Set the current directory as CF_HOME | +| cfh~ | `export CF_HOME=~/.cf` | Set the user's root directory as CF_HOME | +| cfhu | `unset CF_HOME` | Unsets CF_HOME | +| cfpm | `cf push -f` | Push an application using a manifest (requires location) | +| cflr | `cf logs --recent` | Show the recent logs (requires ) | +| cfsrt | `cf start` | Start an application (requires ) | +| cfstp | `cf stop` | Stop an application (requires ) | +| cfstg | `cf restage` | Restage an application (requires ) | +| cfdel | `cf delete` | Delete an application (requires ) | +| cfsrtall | - | Start all apps that are currently in the "Stopped" state | +| cfstpall | - | Stop all apps that are currently in the "Started" state | + +For help and advice on what any of the commands does, consult the built in `cf` help functions as follows:- + +```bash +cf help # List the most popular and commonly used commands +cf help -a # Complete list of all possible commands +cf --help # Help on a specific command including arguments and examples +``` + +Alternatively, seek out the [online documentation][3]. And don't forget, there are loads of great [community plugins for the cf-cli][4] command line tool that can greatly extend its power and usefulness. + +## Contributors + +Contributed to `oh_my_zsh` by [benwilcock][2]. + +[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html +[2]: https://github.com/benwilcock +[3]: https://docs.cloudfoundry.org/cf-cli/getting-started.html +[4]: https://plugins.cloudfoundry.org/ diff --git a/plugins/cloudfoundry/cloudfoundry.plugin.zsh b/plugins/cloudfoundry/cloudfoundry.plugin.zsh new file mode 100644 index 000000000..b6715787e --- /dev/null +++ b/plugins/cloudfoundry/cloudfoundry.plugin.zsh @@ -0,0 +1,34 @@ +# Some Useful CloudFoundry Aliases & Functions +alias cfl="cf login" +alias cft="cf target" +alias cfa="cf apps" +alias cfs="cf services" +alias cfm="cf marketplace" +alias cfp="cf push" +alias cfcs="cf create-service" +alias cfbs="cf bind-service" +alias cfus="cf unbind-service" +alias cfds="cf delete-service" +alias cfup="cf cups" +alias cflg="cf logs" +alias cfr="cf routes" +alias cfe="cf env" +alias cfsh="cf ssh" +alias cfsc="cf scale" +alias cfev="cf events" +alias cfdor="cf delete-orphaned-routes" +alias cfbpk="cf buildpacks" +alias cfdm="cf domains" +alias cfsp="cf spaces" +function cfap() { cf app $1 } +function cfh.() { export CF_HOME=$PWD/.cf } +function cfh~() { export CF_HOME=~/.cf } +function cfhu() { unset CF_HOME } +function cfpm() { cf push -f $1 } +function cflr() { cf logs $1 --recent } +function cfsrt() { cf start $1 } +function cfstp() { cf stop $1 } +function cfstg() { cf restage $1 } +function cfdel() { cf delete $1 } +function cfsrtall() {cf apps | awk '/stopped/ { system("cf start " $1)}'} +function cfstpall() {cf apps | awk '/started/ { system("cf stop " $1)}'}