verflag

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 5 Imported by: 1 module, 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 PrintAndExitIfRequested

func PrintAndExitIfRequested()

PrintAndExitIfRequested 将检查是否传递了 `--version` 标志,如果是,则打印版本并退出.

func VersionVar

func VersionVar(p *VersionValue, name string, value VersionValue, usage string)

VersionVar 定义了一个具有指定名称和用法的标志.

Types

type VersionValue added in v0.3.0

type VersionValue int

VersionValue 表示 --version 标志的状态值.

const (
	VersionFalse VersionValue = 0
	VersionTrue  VersionValue = 1
	VersionRaw   VersionValue = 2
)

定义一些常量.

func Version

func Version(name string, value VersionValue, usage string) *VersionValue

Version 包装了 VersionVar 函数.

func (*VersionValue) Get added in v0.3.0

func (v *VersionValue) Get() interface{}

func (*VersionValue) IsBoolFlag added in v0.3.0

func (v *VersionValue) IsBoolFlag() bool

func (*VersionValue) Set added in v0.3.0

func (v *VersionValue) Set(s string) error

Set 实现了 pflag.Value 接口中的 Set 方法.

func (*VersionValue) String added in v0.3.0

func (v *VersionValue) String() string

String 实现了 pflag.Value 接口中的 String 方法.

func (*VersionValue) Type added in v0.3.0

func (v *VersionValue) Type() string

Type 实现了 pflag.Value 接口中的 Type 方法.

Jump to

Keyboard shortcuts

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