-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
62 lines (50 loc) · 1.11 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/hatsu38/postman-tui/gui"
)
var (
Version string
Revision string
)
func usage() {
format := `
_ _ _
_ __ ___ ___| |_ _ __ ___ __ _ _ __ | |_ _ _(_)
| '_ \ / _ \/ __| __| '_ ' _ \ / _' | '_ \ _____| __| | | | |
| |_) | (_) \__ \ |_| | | | | | (_| | | | |_____| |_| |_| | |
| .__/ \___/|___/\__|_| |_| |_|\__,_|_| |_| \__|\__,_|_|
|_| Version: %s-%s
Usage:
postman-tui
Flags:
-v, -version: Print the current version
-h, -help: Print postman-tui usage
Author:
hatsu38<[email protected]>
`
fmt.Fprintln(os.Stderr, fmt.Sprintf(format, Version, Revision))
}
func run() int {
var i interface{}
if err := gui.New().Run(i); err != nil {
log.Println(err)
return 1
}
return 0
}
func main() {
var withVersion bool
flag.BoolVar(&withVersion, "version", false, "Print the current version")
flag.BoolVar(&withVersion, "v", false, "Print the current version")
flag.Usage = usage
flag.Parse()
if withVersion {
fmt.Println("Version ", Version)
return
}
run()
}