git.sophuwu.com > gophuwu
added other args, returns args that were not parsed
sophuwu sophie@sophuwu.com
Tue, 02 Sep 2025 01:28:02 +0200
commit

4d0bcef509129e8678a658db630ba1c9579182e5

parent

b336dded4177e451cd019557fd0b0a21e47a9009

1 files changed, 10 insertions(+), 1 deletions(-)

jump to
M flags/flags.goflags/flags.go

@@ -2,9 +2,10 @@ package flags

import ( "fmt" - "git.sophuwu.com/gophuwu/parsers" "os" "slices" + + "git.sophuwu.com/gophuwu/parsers" ) type flag struct {

@@ -166,6 +167,12 @@ }

return i.(float64), nil } +var otherArgs []string + +func OtherArgs() []string { + return otherArgs +} + func ParseArgs() error { if len(os.Args) < 2 { return nil

@@ -229,6 +236,8 @@ }

if err != nil { return fmt.Errorf("error parsing flag %s: %v", f.Name, err) } + } else { + otherArgs = append(otherArgs, args[i]) } } if ok, err = GetBoolFlag("help"); err != nil {