Crates.io | gctx |
lib.rs | gctx |
version | 0.6.0 |
source | src |
created_at | 2019-02-28 13:31:49.462927 |
updated_at | 2022-02-20 20:02:22.506233 |
description | A gcloud configuration management utility |
homepage | https://github.com/adamrodger/gcloud-ctx |
repository | https://github.com/adamrodger/gcloud-ctx |
max_upload_size | |
id | 117774 |
size | 54,764 |
A fast replacement for gcloud config configurations
written in Rust for managing Google Cloud Platform gcloud
configurations easily and quickly
Note: This project is independent and not affiliated with Google in any way
Install via scoop
:
scoop bucket add adamrodger https://github.com/adamrodger/scoop-bucket
scoop install gctx
Install via brew
brew install adamrodger/tap/gctx
Grab the latest binary, extract it and add it to your PATH
.
Get the latest stable version of Rust via rustup
and run:
cargo install gctx
## show the current configuration (useful for adding to default prompt)
gctx current
gctx # shorthand, just omit current
## list all configurations
gctx list
## activate a different configuration
gctx my-config
gctx activate my-config # explicitly activate, e.g. if your configuration name clashes with a gctx command
gctx activate # if fzf is installed, you can omit the name and select from a list
## create (and optionally activate) a new configuration
gctx create my-config --project foo \
--account a.user@example.org \
--zone europe-west1-d \
--region europe-west1 \
--force \
--activate
## copy an existing configuration
gctx copy src-name dest-name --force --activate
## show the properties of a configuration (like gcloud config configurations describe)
gctx describe # defaults to the current configuration
gctx describe name # describe a named configuration
## rename a configuration
gctx rename old-name new-name
gctx rename --force old-name existing-name # use force to overwrite an existing configuration
## delete a configuration. note: you can't delete the active configuration
gctx delete my-config
## show help and usage
gctx --help
gctx
auto-detects terminal capabilities by default and supports the NO_COLOR
and
CLICOLOR
standards as provided by the colored
crate. For example:
# will have colors if the terminal supports them
gctx list
# force no colors on output
NO_COLOR=1 gctx list
CLICOLOR=0 gctx list
# force colors on output
CLICOLOR_FORCE=1 gctx list
I'm often working with multiple GCP projects with a variety of different settings (e.g. default compute zone).However,
the standard gcloud
tool has two major problems:
gcloud
is slow to initialise which makes it annoying to use and to add to your default promptAfter having used kubectx
to solve a similar problem switching between
Kubernetes contexts easily, I searched for a similar tool that could easily switch between gcloud
configurations
but couldn't find anything. So, having spent a while learning Rust and being incredibly
impressed, I thought it would make a great starter project.
gctx
aims to achieve similar goals to kubectx
, such as:
gcloud
configurationsgcloud config configurations activate
😄fzf
(if installed)gctx
is distributed under the terms of the MIT license
gctx
crateNote that versions prior to 0.3.0 of the gctx
crate are unrelated works by a previous author
that were yanked and abandoned. The previous author kindly passed the crate name over to me so
that I can reuse it. Thank you again!