added -v
This commit is contained in:
parent
8616fe67dc
commit
87e45046d1
7
init.go
7
init.go
@ -15,9 +15,14 @@ func Init() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
if *ShowVersion {
|
||||||
|
fmt.Printf("gocc %s\n", VERSION)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
if *FindConfigFile {
|
if *FindConfigFile {
|
||||||
if configFilePath, err := configfile.Path("json"); err == nil {
|
if configFilePath, err := configfile.Path("json"); err == nil {
|
||||||
Println(configFilePath)
|
fmt.Println(configFilePath)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
main.go
4
main.go
@ -16,6 +16,8 @@ import (
|
|||||||
"git.milar.in/milarin/channel"
|
"git.milar.in/milarin/channel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var VERSION = "v1.0.3"
|
||||||
|
|
||||||
// globals
|
// globals
|
||||||
var (
|
var (
|
||||||
OutputFileTmpl = template.New("output-file")
|
OutputFileTmpl = template.New("output-file")
|
||||||
@ -53,6 +55,8 @@ var (
|
|||||||
SaveConfigFile = flag.Bool("saveconfig", false, "save config file with current configuration and exit")
|
SaveConfigFile = flag.Bool("saveconfig", false, "save config file with current configuration and exit")
|
||||||
IgnoreConfigFile = flag.Bool("ignoreconfig", false, "dont read any config file")
|
IgnoreConfigFile = flag.Bool("ignoreconfig", false, "dont read any config file")
|
||||||
FindConfigFile = flag.Bool("findconfig", false, "print config file path and exit")
|
FindConfigFile = flag.Bool("findconfig", false, "print config file path and exit")
|
||||||
|
|
||||||
|
ShowVersion = flag.Bool("v", false, "show version and exit")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user