Skip to content

Commit

Permalink
Add version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hatsu38 committed Aug 22, 2021
1 parent 887faf6 commit 489744f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Expand Up @@ -2,9 +2,6 @@ name: Test

on:
pull_request:
push:
branches:
- main

jobs:
test:
Expand Down
36 changes: 24 additions & 12 deletions main.go
Expand Up @@ -16,18 +16,22 @@ var (

func usage() {
format := `
_ _ _
_ __ ___ ___| |_ _ __ ___ __ _ _ __ | |_ _ _(_)
| '_ \ / _ \/ __| __| '_ ' _ \ / _' | '_ \ _____| __| | | | |
| |_) | (_) \__ \ |_| | | | | | (_| | | | |_____| |_| |_| | |
| .__/ \___/|___/\__|_| |_| |_|\__,_|_| |_| \__|\__,_|_|
|_| Version: %s-%s
Usage:
postman-tui
Author:
hatsu38<hajiwata0308@gmail.com>
`
_ _ _
_ __ ___ ___| |_ _ __ ___ __ _ _ __ | |_ _ _(_)
| '_ \ / _ \/ __| __| '_ ' _ \ / _' | '_ \ _____| __| | | | |
| |_) | (_) \__ \ |_| | | | | | (_| | | | |_____| |_| |_| | |
| .__/ \___/|___/\__|_| |_| |_|\__,_|_| |_| \__|\__,_|_|
|_| Version: %s-%s
Usage:
postman-tui
Flags:
-version: Print the current version
Author:
hatsu38<hajiwata0308@gmail.com>
`
fmt.Fprintln(os.Stderr, fmt.Sprintf(format, Version, Revision))
}

Expand All @@ -41,8 +45,16 @@ func run() int {
}

func main() {
var withVersion bool
flag.BoolVar(&withVersion, "version", false, "Print the current version")

flag.Usage = usage
flag.Parse()

if withVersion {
fmt.Println("Version ", Version)
return
}

run()
}

0 comments on commit 489744f

Please sign in to comment.