Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 428 Bytes

README.md

File metadata and controls

20 lines (15 loc) · 428 Bytes

xflag

xflag.ParseToEnd is a drop-in replacement for flag.FlagSet.Parse that keeps parsing after the first positional argument.

if err := xflag.ParseToEnd(flags, os.Args[1:]); err != nil {
	return err
}

This lets both forms work:

todo add --verbose buy-milk
todo add buy-milk --verbose

As with the standard library, -- stops flag parsing and leaves everything after it as positional arguments.