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 (
|
||||
flagPort int
|
||||
flagVersion bool
|
||||
connectionManager ConnectionManager
|
||||
static http.Handler
|
||||
config Config
|
||||
@ -38,6 +39,7 @@ func init() {// {{{
|
||||
1371,
|
||||
"TCP port to listen on",
|
||||
)
|
||||
flag.BoolVar(&flagVersion, "version", false, "Shows Notes version and exists")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
@ -47,6 +49,12 @@ func init() {// {{{
|
||||
}// }}}
|
||||
func main() {// {{{
|
||||
var err error
|
||||
|
||||
if flagVersion {
|
||||
fmt.Printf("%s\n", VERSION)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
log.Printf("\x1b[32mNotes\x1b[0m %s\n", VERSION)
|
||||
|
||||
config, err = ConfigRead(os.Getenv("HOME")+"/.config/notes.yaml")
|
||||
|
Loading…
Reference in New Issue
Block a user