@@ -53,40 +53,6 @@ func ExampleRecursive_withGoFlag() {
5353 // }
5454}
5555
56- // func ExampleAsGoFlag_fooBarBaz() {
57- // type Input struct {
58- // Foo string
59- // Bar string
60- // Baz string
61- // }
62-
63- // fs := flag.NewFlagSet("", flag.ExitOnError)
64- // ops := &jsonflag.Operations{}
65- // for _, f := range jsonflag.Recursive(&Input{}) {
66- // fs.Var(jsonflag.AsGoFlag(ops, f))
67- // }
68- // if err := fs.Parse([]string{"--Foo=foo value", "--Baz=baz value"}); err != nil {
69- // panic(err)
70- // }
71-
72- // i := &Input{}
73- // if err := ops.Apply(i); err != nil {
74- // panic(err)
75- // }
76- // b, err := json.MarshalIndent(i, "", " ")
77- // if err != nil {
78- // panic(err)
79- // }
80- // fmt.Println(string(b))
81-
82- // // Output:
83- // // {
84- // // "Foo": "foo value",
85- // // "Bar": "",
86- // // "Baz": "baz value"
87- // // }
88- // }
89-
9056func ExampleRecursive_withPFlag () {
9157 type Input struct {
9258 Foo string `json:"Foo"`
@@ -125,37 +91,3 @@ func ExampleRecursive_withPFlag() {
12591 // "Baz": "another baz value"
12692 // }
12793}
128-
129- // func ExampleAsPFlag_fooBarBaz() {
130- // type Input struct {
131- // Foo string
132- // Bar string
133- // Baz string
134- // }
135-
136- // fs := pflag.NewFlagSet("", pflag.ExitOnError)
137- // ops := &jsonflag.Operations{}
138- // for _, f := range jsonflag.Recursive(&Input{}) {
139- // fs.AddFlag(jsonflag.AsPFlag(ops, f))
140- // }
141- // if err := fs.Parse([]string{"--Foo=foo value", "--Baz=baz value", "--Baz=another baz value"}); err != nil {
142- // panic(err)
143- // }
144-
145- // i := &Input{}
146- // if err := ops.Apply(i); err != nil {
147- // panic(err)
148- // }
149- // b, err := json.MarshalIndent(i, "", " ")
150- // if err != nil {
151- // panic(err)
152- // }
153- // fmt.Println(string(b))
154-
155- // // Output:
156- // // {
157- // // "Foo": "foo value",
158- // // "Bar": "",
159- // // "Baz": "another baz value"
160- // // }
161- // }
0 commit comments