1 Star 0 Fork 0

powerpaas/machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
flag.go 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
package mcnflag
import "fmt"
type Flag interface {
fmt.Stringer
Default() interface{}
}
type StringFlag struct {
Name string
Usage string
EnvVar string
Value string
}
// TODO: Could this be done more succinctly using embedding?
func (f StringFlag) String() string {
return f.Name
}
func (f StringFlag) Default() interface{} {
return f.Value
}
type StringSliceFlag struct {
Name string
Usage string
EnvVar string
Value []string
}
// TODO: Could this be done more succinctly using embedding?
func (f StringSliceFlag) String() string {
return f.Name
}
func (f StringSliceFlag) Default() interface{} {
return f.Value
}
type IntFlag struct {
Name string
Usage string
EnvVar string
Value int
}
// TODO: Could this be done more succinctly using embedding?
func (f IntFlag) String() string {
return f.Name
}
func (f IntFlag) Default() interface{} {
return f.Value
}
type BoolFlag struct {
Name string
Usage string
EnvVar string
}
// TODO: Could this be done more succinctly using embedding?
func (f BoolFlag) String() string {
return f.Name
}
func (f BoolFlag) Default() interface{} {
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/powerpaas/machine.git
git@gitee.com:powerpaas/machine.git
powerpaas
machine
machine
v0.8.1

搜索帮助