luci-go: github.com/luci/luci-go/common/flag/fixflagpos Index | Files

package fixflagpos

import "github.com/luci/luci-go/common/flag/fixflagpos"

Index

Package Files

fix.go

func Fix Uses

func Fix(args []string) []string

Fix rearranges an `args []string` command line to enable positional arguments to be allowed before flag arguments, which makes some invocations look more natural.

Converts [pos1 pos2 -flag value pos3] into [-flag value pos3 pos1 pos2].

func FixSubcommands Uses

func FixSubcommands(args []string) []string

FixSubcommands is like Fix, except the first positional argument is understood as a subcommand name and it is not moved.

Converts [pos1 pos2 -flag value pos3] into [pos1 -flag value pos3 pos2].

Taking cipd as an example, compare:

* Default: cipd set-ref -ref=abc -version=def package/name
* Improved: cipd set-ref package/name -ref=abc -version=def

Much better.

Package fixflagpos imports 1 packages (graph). Updated 2019-03-16. Refresh now. Tools for package owners.