proper flag parsing
This commit is contained in:
parent
78d958e5f0
commit
7bb8257420
8
main.go
8
main.go
|
@ -7,6 +7,7 @@ import (
|
|||
"cwtch.im/ui/go/gobjects"
|
||||
"cwtch.im/ui/go/gothings"
|
||||
"cwtch.im/ui/go/the"
|
||||
"flag"
|
||||
"fmt"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
|
||||
"git.openprivacy.ca/openprivacy/libricochet-go/log"
|
||||
|
@ -30,8 +31,11 @@ func init() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
flagDebug := flag.Bool("debug", false, "turn on extra logging. WARNING: THIS MAY EXPOSE PRIVATE INFORMATION IN CONSOLE OUTPUT!")
|
||||
flagLocal := flag.Bool("local", false, "load user interface from the local folder \"qml\" instead of the built-in UI")
|
||||
flag.Parse()
|
||||
|
||||
if len(os.Args) >= 3 && os.Args[2] == "-debug" {
|
||||
if *flagDebug {
|
||||
log.SetLevel(log.LevelDebug)
|
||||
} else {
|
||||
log.SetLevel(log.LevelInfo)
|
||||
|
@ -48,7 +52,7 @@ func main() {
|
|||
|
||||
// this is to load local qml files quickly when developing
|
||||
var qmlSource *core.QUrl
|
||||
if len(os.Args) >= 2 && os.Args[1] == "-local" {
|
||||
if *flagLocal {
|
||||
qmlSource = core.QUrl_FromLocalFile("./qml/main.qml")
|
||||
} else {
|
||||
qmlSource = core.NewQUrl3("qrc:/qml/main.qml", 0)
|
||||
|
|
Reference in New Issue