go-arg:Go中基于结构的参数解析

时间:2021-04-28 15:03:30
【文件属性】:
文件名称:go-arg:Go中基于结构的参数解析
文件大小:41KB
文件格式:ZIP
更新时间:2021-04-28 15:03:30
golang argument-parsing Go go-arg Go的基于结构的参数解析 通过定义结构来声明程序的命令行参数。 var args struct { Foo string Bar bool } arg . MustParse ( & args ) fmt . Println ( args . Foo , args . Bar ) $ ./example --foo=hello --bar hello true 安装 go get github.com/alexflint/go-arg 必填参数 var args struct { ID int `arg:"required"` Timeout time. Duration } arg . MustParse ( & args ) $ ./example Usage: example --id ID [--timeout TIMEOUT] error: -
【文件预览】:
go-arg-master
----.gitignore(266B)
----go.mod(132B)
----parse.go(19KB)
----doc.go(1KB)
----reflect.go(3KB)
----LICENSE(1KB)
----sequence.go(3KB)
----go.sum(700B)
----.github()
--------workflows()
--------banner.jpg(10KB)
----reflect_test.go(3KB)
----example_test.go(10KB)
----README.md(12KB)
----usage.go(6KB)
----subcommand.go(1KB)
----sequence_test.go(4KB)
----subcommand_test.go(9KB)
----parse_test.go(31KB)
----usage_test.go(12KB)

网友评论