Added command line arg -version
This commit is contained in:
parent
d060b0595d
commit
832678ba73
8
main.go
8
main.go
@ -26,6 +26,7 @@ const DB_SCHEMA = 13
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
flagPort int
|
flagPort int
|
||||||
|
flagVersion bool
|
||||||
connectionManager ConnectionManager
|
connectionManager ConnectionManager
|
||||||
static http.Handler
|
static http.Handler
|
||||||
config Config
|
config Config
|
||||||
@ -38,6 +39,7 @@ func init() {// {{{
|
|||||||
1371,
|
1371,
|
||||||
"TCP port to listen on",
|
"TCP port to listen on",
|
||||||
)
|
)
|
||||||
|
flag.BoolVar(&flagVersion, "version", false, "Shows Notes version and exists")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@ -47,6 +49,12 @@ func init() {// {{{
|
|||||||
}// }}}
|
}// }}}
|
||||||
func main() {// {{{
|
func main() {// {{{
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
|
if flagVersion {
|
||||||
|
fmt.Printf("%s\n", VERSION)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
log.Printf("\x1b[32mNotes\x1b[0m %s\n", VERSION)
|
log.Printf("\x1b[32mNotes\x1b[0m %s\n", VERSION)
|
||||||
|
|
||||||
config, err = ConfigRead(os.Getenv("HOME")+"/.config/notes.yaml")
|
config, err = ConfigRead(os.Getenv("HOME")+"/.config/notes.yaml")
|
||||||
|
Loading…
Reference in New Issue
Block a user