How to use appargs #2415
Replies: 3 comments
-
Can you show a little more code, including when you read |
Beta Was this translation helpful? Give feedback.
-
The issue came from the fact that I was trying to read the flags in the main function. For some reason, the code was not executed there. So I now read them in the NewApp() function. Is it considered as the way to do it ? |
Beta Was this translation helpful? Give feedback.
-
I am confused with args Can someone help please I parse flags ar main.go using lclConfigFlag := flag.String("config", "", "Configuration file.")
flag.Parse()
fmt.Println("Config flag value:", *lclConfigFlag) and execute wails dev -appargs "-config SOME_FILE"
wails dev --appargs "-config SOME_FILE"
wails dev -appargs "config SOME_FILE"
wails dev -appargs "--config SOME_FILE"
wails dev -appargs "config SOME_FILE" If I build I can pass the flag successfully |
Beta Was this translation helpful? Give feedback.
-
I have tried to use the appargs variable in the wails.json config file like this :
"appargs": "mode=dev"
I also tried starting wails with args like this : wails dev -appargs "mode=dev".
Then, the args are read in the main.go file (and stored in a variable) :
flag.Parse()
variables.ARGS = flag.Args()
But the variable is always empty. What am I doing wrong ?
Beta Was this translation helpful? Give feedback.
All reactions