flag

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitFlags

func InitFlags(flags *pflag.FlagSet)

InitFlags 初始化

func PrintFlags

func PrintFlags(flags *pflag.FlagSet)

PrintFlags 打印标志 可以打印所有的命令行参数

func PrintSections

func PrintSections(w io.Writer, fss NamedFlagSets, cols int)

PrintSections 打印给定的标志集名称,并按最大列数进行分组 如果 cols 为零,则不进行换行

func WarnWordSepNormalizeFunc

func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName

WarnWordSepNormalizeFunc 警告包含 "_" 分隔符的标志 当命令行参数中带有 "_" 时输出警告,并自动转换为 "-"

func WordSepNormalizeFunc

func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName

WordSepNormalizeFunc 单词分隔符规范化函数

Types

type NamedFlagSets

type NamedFlagSets struct {
	// Order 按顺序存储标志集名称的列表
	Order []string
	// FlagSets 按名称存储标志集
	FlagSets map[string]*pflag.FlagSet
}

NamedFlagSets 存储按调用 FlagSet 顺序命名的标志集

func (*NamedFlagSets) FlagSet

func (nfs *NamedFlagSets) FlagSet(name string) *pflag.FlagSet

FlagSet 设置标识符集 注:也就是给命令行参数进行分组

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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