clop v0.0.12 发布,go 实现的纯结构体命令行解析器
clop v0.0.12 版本现已发布。地址:
更新内容
本地新加short, long 标记,可以更快地实现命令行解析器
package main import ( "fmt" "github.com/guonaihong/clop" ) type cat struct { NumberNonblank bool `clop:"-c;long" usage:"number nonempty output lines, overrides"` ShowEnds bool `clop:"-E;long" usage:"display $ at end of each line"` Number bool `clop:"-n;long" usage:"number all output lines"` SqueezeBlank bool `clop:"-s;long" usage:"suppress repeated empty output lines"` ShowTab bool `clop:"-T;long" usage:"display TAB characters as ^I"` ShowNonprinting bool `clop:"-v;long" usage:"use ^ and M- notation, except for LFD and TAB" ` Files []string `clop:"args=files"` } func main() { c := cat{} err := clop.Bind(&c) fmt.Printf("%#v, %s\n", c, err) }