Skip to content

Commit 4eb5aa1

Browse files
authored
Merge pull request #6 from sakebook/feat/add-version-flag
feat: add version flag
2 parents 3fdadcc + 332b250 commit 4eb5aa1

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.1.1] - 2026-01-06
9+
### Added
10+
- `--version` / `-v` flag to display version information.
11+
812
## [0.1.0] - 2026-01-06
913

1014
### Added

gsw.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22

33
# gsw: Google Switch
44
# Easily switch between gcloud configurations
5+
GSW_VERSION="v0.1.1"
6+
57
function gsw() {
8+
if [ "$1" = "--version" ] || [ "$1" = "-v" ]; then
9+
echo "gsw version $GSW_VERSION"
10+
return 0
11+
fi
12+
613
if [ -z "$1" ]; then
714
echo "Available gcloud configurations:"
815
gcloud config configurations list
916
echo ""
1017
echo "Usage: gsw <config_name>"
18+
echo " gsw --version"
1119
echo " Switches the GLOBAL active configuration."
1220
echo ""
1321
echo "💡 Tip: To switch automatically when entering a directory,"

test/gsw.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,10 @@ setup() {
4242
[ "$status" -eq 0 ]
4343
[[ "$output" =~ "Usage: gsw" ]]
4444
}
45+
46+
@test "gsw --version outputs version" {
47+
run gsw --version
48+
[ "$status" -eq 0 ]
49+
# Check format: gsw version vX.X.X
50+
[[ "$output" =~ "gsw version v"[0-9]+\.[0-9]+\.[0-9]+ ]]
51+
}

0 commit comments

Comments
 (0)