Documentation
¶
Overview ¶
Package xflag extends the standard library's flag package to support parsing flags interleaved with positional arguments. By default, Go's flag package stops parsing flags at the first non-flag argument, which is unintuitive for most CLI users. This package provides ParseToEnd as a drop-in replacement that handles flags anywhere in the argument list.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseToEnd ¶
ParseToEnd is a drop-in replacement for flag.Parse. It improves upon the standard behavior by parsing flags even when they are interspersed with positional arguments. This overcomes Go's default limitation of stopping flag parsing upon encountering the first positional argument. For more details, see:
This is a bit unfortunate, but most users nowadays consuming CLI tools expect this behavior.
Types ¶
This section is empty.