Skip to content

Commit 543e05a

Browse files
committed
feat: Add version command
1 parent 862120d commit 543e05a

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

.goreleaser.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
builds:
22
- env:
33
- CGO_ENABLED=0
4+
ldflags:
5+
- -X 'main.ProgramVersion={{.Version}}'
46
goos:
57
- linux
68
- windows

data.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package main
22

33
import "time"
44

5+
var ProgramVersion = "development" // It will be replaced with a git tag.
6+
57
// 지원 통화
68
var currencyList = [...]string{
79
"KRW",

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ module cvtr
22

33
go 1.24.4
44

5+
require github.com/fatih/color v1.18.0
6+
57
require (
6-
github.com/fatih/color v1.18.0 // indirect
78
github.com/mattn/go-colorable v0.1.13 // indirect
89
github.com/mattn/go-isatty v0.0.20 // indirect
910
golang.org/x/sys v0.25.0 // indirect

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,10 @@ func main() {
199199
boldCyan("%s\n", comma(result))
200200

201201
}
202-
case "help":
202+
case "help", "-h", "--help":
203203
help()
204+
case "version", "-V", "-v", "--version":
205+
fmt.Printf("cvtr %s\n", ProgramVersion)
204206
default:
205207
boldRed("error: %s is an invalid command\n", os.Args[1])
206208
}

0 commit comments

Comments
 (0)