cmdhelper

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveEnvVariable

func ResolveEnvVariable(cmd *cobra.Command, f interface{})

func ResolveFlagVariable

func ResolveFlagVariable(cmd *cobra.Command, f interface{})

ResolveFlagVariable register flags and env

func Version

func Version() *cobra.Command

Types

type EnvFlag

type EnvFlag struct {
	Env   string
	Split string
}

type EnvFlags

type EnvFlags map[string]EnvFlag

type Flag

type Flag struct {
	// e.g. foo
	Name string
	// With struct hierarchy prefix
	// e.g. prefix-foo
	FullName string

	// Enable env
	EnableEnv bool
	// With struct hierarchy prefix
	// e.g. PREFIX_FOO
	FullEnv string

	Split     string
	Shorthand string
	Usage     string

	Type    string
	Value   interface{}
	Pointer interface{}
}

type Flags

type Flags []Flag

Jump to

Keyboard shortcuts

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