Skip to content

jesbinjoseph/gcloudx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gx

A minimal shell plugin for kubectx-style Google Cloud project switching.

Uses fzf for interactive fuzzy project selection and wraps gcloud project switching into two fast commands.

Commands

Command Description
gx Permanently switch the active project via gcloud config set project
tgx Temporarily switch the project for the current shell session only (sets CLOUDSDK_CORE_PROJECT)

Requirements

Install

git clone https://github.com/jesbinjoseph/gcloudx.git
cd gcloudx
bash install.sh

install.sh copies gx.plugin.zsh to ~/.gx/ and adds a source line to ~/.zshrc and/or ~/.bashrc.

Restart your shell, or source the plugin manually:

source ~/.gx/gx.plugin.zsh

Uninstall

bash uninstall.sh

Removes ~/.gx/ and cleans the source line from ~/.zshrc / ~/.bashrc.

Usage

Run gx to permanently switch your active project:

$ gx
> my-project-a
  my-project-b
  my-project-c
Switched to project: my-project-a

Run tgx to switch only for the current shell session:

$ tgx
> my-project-b
CLOUDSDK_CORE_PROJECT=my-project-b (session only)

Press Esc or Ctrl-C in fzf to cancel without making any changes.

Design

  • Two shell functions, no config files, no abstractions.
  • No dependencies beyond gcloud and fzf.
  • POSIX-compatible ([ ] tests, works in both zsh and bash).
  • Cancelling fzf selection (empty result) is a no-op.

About

A minimal shell plugin for kubectx-style Google Cloud project switching.

Resources

Stars

Watchers

Forks

Contributors

Languages