Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Commit 636e750

Browse files
authored
[flag] add '-v' '--version' 'version'
1 parent c7b4084 commit 636e750

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fgit.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ var version string
1919
func showVersion() {
2020
fmt.Println("Version:", version)
2121
fmt.Println("Build Time:", timestamp)
22+
os.Exit(0)
2223
}
2324

2425
func debugConnection(url string) bool {
@@ -194,6 +195,10 @@ func main() {
194195
os.Exit(0)
195196
}
196197

198+
if os.Args[1] == "-v" || os.Args[1] == "--version" || os.Args[1] == "version" {
199+
showVersion()
200+
}
201+
197202
for i := range os.Args {
198203
if os.Args[i] == "push" || os.Args[i] == "pull" {
199204
isPushOrPull = true

0 commit comments

Comments
 (0)