cliutil

package
v0.16.14 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PromptCompleter

func PromptCompleter(rootCmd *cobra.Command) func(d prompt.Document) []prompt.Suggest

PromptCompleter returns a completer function used by prompt package. This function is useful to create an interactive shell based on the rootCmd as the root commands.

func PromptExecutor

func PromptExecutor(rootCmd *cobra.Command) func(s string)

PromptExecutor returns an executor function used by prompt package. This function is useful to create an interactive shell based on the rootCmd as the root commands.

func RunShell

func RunShell(cmd *cobra.Command)

RunShell runs an interactive shell

func SetFlags

func SetFlags(cmd *cobra.Command, opts ...FlagOption)

SetFlags applies 'opts' on 'cmd' flags in order.

func SetPersistentFlags

func SetPersistentFlags(cmd *cobra.Command, opts ...FlagOption)

SetPersistentFlags applies 'opts' on 'cmd' persistent flags.

Types

type FlagOption

type FlagOption func(fs *pflag.FlagSet)

FlagOption applies some predefined configurations on a FlagSet.

func RegisterBoolFlag

func RegisterBoolFlag(name string, value bool, usage string) FlagOption

func RegisterDurationFlag

func RegisterDurationFlag(name string, value time.Duration, usage string) FlagOption

func RegisterInt32Flag

func RegisterInt32Flag(name string, value int32, usage string) FlagOption

func RegisterInt64Flag

func RegisterInt64Flag(name string, value int64, usage string) FlagOption

func RegisterInt64SliceFlag

func RegisterInt64SliceFlag(name string, value []int64, usage string) FlagOption

func RegisterIntFlag

func RegisterIntFlag(name string, value int, usage string) FlagOption

func RegisterStringFlag

func RegisterStringFlag(name, value, usage string) FlagOption

func RegisterStringSliceFlag

func RegisterStringSliceFlag(name string, value []string, usage string) FlagOption

func RegisterUInt64Flag

func RegisterUInt64Flag(name string, value uint64, usage string) FlagOption

Jump to

Keyboard shortcuts

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