Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.1] - 2026-01-06
### Added
- `--version` / `-v` flag to display version information.

## [0.1.0] - 2026-01-06

### Added
Expand Down
8 changes: 8 additions & 0 deletions gsw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

# gsw: Google Switch
# Easily switch between gcloud configurations
GSW_VERSION="v0.1.1"

function gsw() {
if [ "$1" = "--version" ] || [ "$1" = "-v" ]; then
echo "gsw version $GSW_VERSION"
return 0
fi

if [ -z "$1" ]; then
echo "Available gcloud configurations:"
gcloud config configurations list
echo ""
echo "Usage: gsw <config_name>"
echo " gsw --version"
echo " Switches the GLOBAL active configuration."
echo ""
echo "💡 Tip: To switch automatically when entering a directory,"
Expand Down
7 changes: 7 additions & 0 deletions test/gsw.bats
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ setup() {
[ "$status" -eq 0 ]
[[ "$output" =~ "Usage: gsw" ]]
}

@test "gsw --version outputs version" {
run gsw --version
[ "$status" -eq 0 ]
# Check format: gsw version vX.X.X
[[ "$output" =~ "gsw version v"[0-9]+\.[0-9]+\.[0-9]+ ]]
}