Skip to content

Instantly share code, notes, and snippets.

@mfurlend
Created January 16, 2019 14:41
Show Gist options
  • Save mfurlend/c2aac80604dc5c658b771ea414075f7b to your computer and use it in GitHub Desktop.
Save mfurlend/c2aac80604dc5c658b771ea414075f7b to your computer and use it in GitHub Desktop.
Fast google cloud profile switching/listing
goo () {
local inp1 inp2
inp1=$1
inp2=$2
if (( ! $# ))
then
inp1="-h"
fi
if [[ $inp1 == "-h" || $inp1 == "--help" ]]
then
echo "$0 - google cloud profile switching\n"
echo "usage: $0 -h"
echo "usage: $0 -l"
echo "usage: $0 -p default\n\nOptions:"
echo "\t-h, --help\t\t\t display help message and exit"
echo "\t-l, --list\t\t\t list profiles"
echo "\t-p, --profile=name\t\t switch profile"
return 1
elif [[ $inp1 == "-l" || $inp1 == "--list" ]]
then
gcloud config configurations list
elif [[ ( $inp1 == "-p" || $inp1 == "--profile" ) && $inp2 != "" ]]
then
gcloud config configurations activate "$inp2"
else
echo "idk wtf"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment