diff --git a/.example/os/gcmd/main.go b/.example/os/gcmd/main.go new file mode 100644 index 000000000..3cae98c12 --- /dev/null +++ b/.example/os/gcmd/main.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + + "github.com/gogf/gf/frame/g" + "github.com/gogf/gf/os/gcmd" +) + +func main() { + p, err := gcmd.Parse(g.MapStrBool{ + "n,name": true, + "p,prefix": true, + "f,force": false, + "t,tail": false, + "i,interactive": false, + }) + if err != nil { + fmt.Println(err) + } + g.Dump(p) +} diff --git a/frame/g/g.go b/frame/g/g.go index 8e84169cf..aa85b5678 100644 --- a/frame/g/g.go +++ b/frame/g/g.go @@ -22,6 +22,9 @@ type MapStrInt = map[string]int type MapIntAny = map[int]interface{} type MapIntStr = map[int]string type MapIntInt = map[int]int +type MapAnyBool = map[interface{}]bool +type MapStrBool = map[string]bool +type MapIntBool = map[int]bool // Frequently-used slice type alias. type List = []Map @@ -33,6 +36,9 @@ type ListStrInt = []map[string]int type ListIntAny = []map[int]interface{} type ListIntStr = []map[int]string type ListIntInt = []map[int]int +type ListAnyBool = []map[interface{}]bool +type ListStrBool = []map[string]bool +type ListIntBool = []map[int]bool // Frequently-used slice type alias. type Slice = []interface{}