Giter Club home page Giter Club logo

gconf's Introduction

gconf: Switch gcloud configurations

CircleCI Proudly written in Bash

Makes it easier to switch configurations in the gcloud CLI.

Idea and patterns stolen from ahmetb's kubectx. Go check it out, it's awesome!

Usage

gcloud init your configurations, then:

gconf                    : list available configs
gconf <NAME>             : activate config
gconf -                  : switch to previously active config
gconf -h,--help          : show this message

Installation

Since gconf is written in Bash, you should be able to install it to any POSIX environment that has Bash installed.

  • Download the gconf script.
  • Either:
    • save it somewhere in your PATH,
    • or save it to a directory, then create symlinks to gconf from somewhere in your PATH, like /usr/local/bin
  • Make gconf executable (chmod +x ...)
  • Install bash/zsh/fish completion scripts.
    • For zsh:
      The completion scripts have to be in a path that belongs to $fpath. Either link or copy them to an existing folder.
      If using oh-my-zsh you can do as follows:
      git clone https://github.com/uhinze/gconf.git ~/.gconf
      mkdir -p ~/.oh-my-zsh/completions
      chmod -R 755 ~/.oh-my-zsh/completions
      ln -s ~/.gconf/completion/gconf.zsh ~/.oh-my-zsh/completions/_gconf.zsh
      If autocomplete isn't loaded on logout/login, try the following:
      compinit -d $ZSH_COMPDUMP
      
      This refreshes the compinit dumpfile.
    • For bash:
      git clone https://github.com/uhinze/gconf.git ~/.gconf
      COMPDIR=$(pkg-config --variable=completionsdir bash-completion)
      ln -sf ~/.gconf/completion/gconf.bash $COMPDIR/gconf
    • For fish:
      mkdir -p ~/.config/fish/completions
      ln -s /opt/gconf/completion/gconf.fish ~/.config/fish/completions/

Interactive mode

If you want gconf to present you an interactive menu with fuzzy searching, you just need to install fzf in your PATH.

If you have fzf installed, but want to opt out of using this feature, set the environment variable GCONF_IGNORE_FZF=1.


Customizing colors

If you like to customize the colors indicating the current namespace or context, set the environment variables GCONF_CURRENT_FGCOLOR and GCONF_CURRENT_BGCOLOR (refer color codes here):

export GCONF_CURRENT_FGCOLOR=$(tput setaf 6) # blue text
export GCONF_CURRENT_BGCOLOR=$(tput setab 7) # white background

Colors in the output can be disabled by setting the NO_COLOR environment variable.

gconf's People

Contributors

uhinze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.