cli

package
v0.0.0-...-06bdd8b Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cli provides helper functions around command line interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixDeprecatedFlags

func FixDeprecatedFlags(args []string, w io.Writer, m map[string]ReplaceFlagFunc) []string

FixDeprecatedFlags transforms args so that they are conforming to the new CLI structure: - replace non-posix flags posix flags - replace deprecated flags with their command equivalents - display warnings when deprecated flags are encountered

Types

type ReplaceFlag

type ReplaceFlag struct {
	Hint string
	Args []string
}

ReplaceFlag structure that will hold `Args` after replacing a flags and a `Hint` of the flag that was replaced.

func ReplaceFlagPosix

func ReplaceFlagPosix(arg string, flag string) ReplaceFlag

ReplaceFlagPosix replaces a single-dash flag with a POSIX flag.

type ReplaceFlagFunc

type ReplaceFlagFunc func(arg string, flag string) ReplaceFlag

ReplaceFlagFunc type for a function that will produce a ReplaceFlag for the provided `arg` and `flag`.

func ReplaceFlagExact

func ReplaceFlagExact(replaceWith string) ReplaceFlagFunc

ReplaceFlagExact will replace the matching flag with `replaceWith` exactly.

func ReplaceFlagSubCommandPosArg

func ReplaceFlagSubCommandPosArg(replaceWith string) ReplaceFlagFunc

ReplaceFlagSubCommandPosArg replaces a subcomand sub-positional argument in the for `--foo=bar` with `--foo bar`.

Jump to

Keyboard shortcuts

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