Giter Site home page Giter Site logo

gcloud-prompt's Introduction

test

gcloud-prompt

Fetch gcloud client configuration information to show on shell prompt.

Currently, Bash & Zsh are supported.

Usage

Zsh:

. path/to/gcloud-prompt/gcloud-prompt.sh
# Example prompt setting
PROMPT="%F{cyan}[\$(gcloud_prompt)]%f %n@%m%# "

Bash:

. path/to/gcloud-prompt/gcloud-prompt.sh
# Example prompt setting
PS1="\[\e[0;36m\]<\$(gcloud_prompt)>\[\e[m\]\n\h:\W \u\$ "

Execute toggle_gcloud_prompt function to hide/show gcloud information.

Examples

Here are some output examples.

# Default setting & default configuration
$ gcloud_prompt
default|[email protected],my-project

# GCLOUD_PROMPT_CONFIG_KEYS=(core.project compute.region)
$ gcloud_prompt
default|my-project,asia-northeast1

# GCLOUD_PROMPT_SHOW_CONFIG_PARAMS=no
$ gcloud_prompt
default

Configuration

You can change below variables to customize the prompt output.

Variable Default Type Description
GCLOUD_PROMPT_ENABLED on String If this variable is not set, gcloud_prompt prints nothing
GCLOUD_PROMPT_SHOW_CONFIG_PARAMS yes String If this variable doesn't equal to "yes", only current active configuration shows on prompt
GCLOUD_PROMPT_CONFIG_KEYS (core.account core.project) Array When GCLOUD_PROMPT_SHOW_CONFIG_PARAMS is set to yes, these properties appears on prompt
GCLOUD_PROMPT_SEPARATOR | String Delimiter between active configuration and config properties

For available properties to set in GCLOUD_PROMPT_CONFIG_KEYS, refer to https://cloud.google.com/sdk/gcloud/reference/config/get-value

Dependencies

This script depends on the current implementation of Cloud SDK; such as configuration directory structure, configuration data structure etc.

License

The MIT License.

Copyright (c) 2020 IKEDA Kiyoshi.

gcloud-prompt's People

Contributors

progrhyme avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.