Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version flag #15

Merged
merged 3 commits into from
Aug 22, 2021
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
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Test

on:
pull_request:
push:
branches:
- main

jobs:
test:
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ https://user-images.githubusercontent.com/16137809/129535113-e5c9447a-0171-4056-
brew install hatsu38/postman-tui/postman-tui
```

<img width="704" alt="usage postman-tui" src="https://user-images.githubusercontent.com/16137809/130349991-781f28d6-c1ec-46dd-b474-a11fd6664d11.png">


## Lint

```sh
Expand Down Expand Up @@ -46,4 +49,4 @@ If you have any concerns, please contact us at ↓.
https://twitter.com/hatsu_38

## License
This code is free to use under the terms of the MIT license.
This code is free to use under the terms of the MIT license.
38 changes: 25 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ var (
)

func usage() {
format := `
_ _ _
_ __ ___ ___| |_ _ __ ___ __ _ _ __ | |_ _ _(_)
| '_ \ / _ \/ __| __| '_ ' _ \ / _' | '_ \ _____| __| | | | |
| |_) | (_) \__ \ |_| | | | | | (_| | | | |_____| |_| |_| | |
| .__/ \___/|___/\__|_| |_| |_|\__,_|_| |_| \__|\__,_|_|
|_| Version: %s-%s

Usage:
postman-tui
Author:
hatsu38<hajiwata0308@gmail.com>
`
format :=
` _ _ _
_ __ ___ ___| |_ _ __ ___ __ _ _ __ | |_ _ _(_)
| '_ \ / _ \/ __| __| '_ ' _ \ / _' | '_ \ _____| __| | | | |
| |_) | (_) \__ \ |_| | | | | | (_| | | | |_____| |_| |_| | |
| .__/ \___/|___/\__|_| |_| |_|\__,_|_| |_| \__|\__,_|_|
|_| 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()
}