fixflagpos

package
v0.0.0-...-d3da680 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 1 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL