mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
args: respect other args when start/stop/daemon are used
these being present in os.Args messes up "flag"'s parsing of the rest of the arguments, so when they are found, they are removed. Fixes #267
This commit is contained in:
parent
456c99d7db
commit
d688dd02c8
6
main.go
6
main.go
@ -613,9 +613,13 @@ func (app *appContext) shutdown() {
|
||||
}
|
||||
|
||||
func flagPassed(name string) (found bool) {
|
||||
for _, f := range os.Args {
|
||||
for i, f := range os.Args {
|
||||
if f == name {
|
||||
found = true
|
||||
// Remove the flag, to avoid issues wit the flag library.
|
||||
os.Args = append(os.Args[:i], os.Args[i+1:]...)
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user