Back to godoc.org

Package fixflagpos

v0.0.0-...-1557bcf
Latest Go to latest

The latest major version is .

Published: Aug 13, 2020 | License: Apache-2.0 | Module: github.com/luci/luci-go

Index

func Fix

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

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier