Skip to content

Commit

Permalink
Merge pull request #15 from hatsu38/featurer/add-flag-version
Browse files Browse the repository at this point in the history
Add version flag
  • Loading branch information
hatsu38 authored Aug 22, 2021
2 parents 887faf6 + 689a140 commit 963aeeb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
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<[email protected]>
`
format :=
` _ _ _
_ __ ___ ___| |_ _ __ ___ __ _ _ __ | |_ _ _(_)
| '_ \ / _ \/ __| __| '_ ' _ \ / _' | '_ \ _____| __| | | | |
| |_) | (_) \__ \ |_| | | | | | (_| | | | |_____| |_| |_| | |
| .__/ \___/|___/\__|_| |_| |_|\__,_|_| |_| \__|\__,_|_|
|_| Version: %s-%s
Usage:
postman-tui
Flags:
-version: Print the current version
Author:
hatsu38<[email protected]>
`
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 963aeeb

Please sign in to comment.