@@ -34,27 +34,31 @@ import (
34
34
// opts optsT
35
35
// )
36
36
//
37
- // var parser = flags.NewParser(&opts, flags.Default)
37
+ // var gfParser = flags.NewParser(&opts, flags.Default)
38
38
39
39
////////////////////////////////////////////////////////////////////////////
40
40
// Function definitions
41
41
42
+ //==========================================================================
42
43
// Function main
43
44
// func main() {
44
45
// opts.Version = showVersion
45
46
// opts.Verbflg = func() {
46
47
// opts.Verbose++
47
48
// }
48
49
//
49
- // if _, err := parser .Parse(); err != nil {
50
+ // if _, err := gfParser .Parse(); err != nil {
50
51
// fmt.Println()
51
- // parser .WriteHelp(os.Stdout)
52
+ // gfParser .WriteHelp(os.Stdout)
52
53
// os.Exit(1)
53
54
// }
54
55
// fmt.Println()
55
56
// //DoJsonfiddle()
56
57
// }
57
58
//
59
+ // //==========================================================================
60
+ // // support functions
61
+ //
58
62
// func showVersion() {
59
63
// fmt.Fprintf(os.Stderr, "jsonfiddle - JSON Fiddling, version %s\n", version)
60
64
// fmt.Fprintf(os.Stderr, "Built on %s\n", date)
@@ -114,8 +118,11 @@ type optsT struct {
114
118
//
115
119
// var escCommand EscCommand
116
120
//
121
+ // ////////////////////////////////////////////////////////////////////////////
122
+ // // Function definitions
123
+ //
117
124
// func init() {
118
- // parser .AddCommand("esc",
125
+ // gfParser .AddCommand("esc",
119
126
// "Escape json string",
120
127
// "",
121
128
// &escCommand)
@@ -126,16 +133,16 @@ type optsT struct {
126
133
// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
127
134
// clis.Setup("jsonfiddle::esc", opts.Verbose)
128
135
// clis.Verbose(1, "Doing Esc, with %+v, %+v", opts, args)
129
- // fmt.Println(x.Filei, x.Fileo)
136
+ // // fmt.Println(x.Filei, x.Fileo)
130
137
// return x.Exec(args)
131
138
// }
132
139
//
133
- // Exec implements the business logic of command `esc`
140
+ // // Exec implements the business logic of command `esc`
134
141
// func (x *EscCommand) Exec(args []string) error {
135
142
// // err := ...
136
- // // clis.WarnOn("Esc, Exec", err)
143
+ // // clis.WarnOn("esc:: Exec", err)
137
144
// // or,
138
- // // clis.AbortOn("Esc, Exec", err)
145
+ // // clis.AbortOn("esc:: Exec", err)
139
146
// return nil
140
147
// }
141
148
// Template for "esc" CLI handling ends here
@@ -170,8 +177,11 @@ type optsT struct {
170
177
//
171
178
// var fmtCommand FmtCommand
172
179
//
180
+ // ////////////////////////////////////////////////////////////////////////////
181
+ // // Function definitions
182
+ //
173
183
// func init() {
174
- // parser .AddCommand("fmt",
184
+ // gfParser .AddCommand("fmt",
175
185
// "Format json string",
176
186
// "",
177
187
// &fmtCommand)
@@ -182,16 +192,16 @@ type optsT struct {
182
192
// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
183
193
// clis.Setup("jsonfiddle::fmt", opts.Verbose)
184
194
// clis.Verbose(1, "Doing Fmt, with %+v, %+v", opts, args)
185
- // fmt.Println(x.Filei, x.Fileo)
195
+ // // fmt.Println(x.Filei, x.Fileo)
186
196
// return x.Exec(args)
187
197
// }
188
198
//
189
- // Exec implements the business logic of command `fmt`
199
+ // // Exec implements the business logic of command `fmt`
190
200
// func (x *FmtCommand) Exec(args []string) error {
191
201
// // err := ...
192
- // // clis.WarnOn("Fmt, Exec", err)
202
+ // // clis.WarnOn("fmt:: Exec", err)
193
203
// // or,
194
- // // clis.AbortOn("Fmt, Exec", err)
204
+ // // clis.AbortOn("fmt:: Exec", err)
195
205
// return nil
196
206
// }
197
207
// Template for "fmt" CLI handling ends here
@@ -226,8 +236,11 @@ type optsT struct {
226
236
//
227
237
// var sortCommand SortCommand
228
238
//
239
+ // ////////////////////////////////////////////////////////////////////////////
240
+ // // Function definitions
241
+ //
229
242
// func init() {
230
- // parser .AddCommand("sort",
243
+ // gfParser .AddCommand("sort",
231
244
// "Sort json fields recursively",
232
245
// "",
233
246
// &sortCommand)
@@ -238,16 +251,16 @@ type optsT struct {
238
251
// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
239
252
// clis.Setup("jsonfiddle::sort", opts.Verbose)
240
253
// clis.Verbose(1, "Doing Sort, with %+v, %+v", opts, args)
241
- // fmt.Println(x.Filei, x.Fileo)
254
+ // // fmt.Println(x.Filei, x.Fileo)
242
255
// return x.Exec(args)
243
256
// }
244
257
//
245
- // Exec implements the business logic of command `sort`
258
+ // // Exec implements the business logic of command `sort`
246
259
// func (x *SortCommand) Exec(args []string) error {
247
260
// // err := ...
248
- // // clis.WarnOn("Sort, Exec", err)
261
+ // // clis.WarnOn("sort:: Exec", err)
249
262
// // or,
250
- // // clis.AbortOn("Sort, Exec", err)
263
+ // // clis.AbortOn("sort:: Exec", err)
251
264
// return nil
252
265
// }
253
266
// Template for "sort" CLI handling ends here
@@ -286,8 +299,11 @@ type optsT struct {
286
299
//
287
300
// var j2sCommand J2sCommand
288
301
//
302
+ // ////////////////////////////////////////////////////////////////////////////
303
+ // // Function definitions
304
+ //
289
305
// func init() {
290
- // parser .AddCommand("j2s",
306
+ // gfParser .AddCommand("j2s",
291
307
// "JSON to struct",
292
308
// "JSON convert to Go struct",
293
309
// &j2sCommand)
@@ -298,16 +314,16 @@ type optsT struct {
298
314
// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
299
315
// clis.Setup("jsonfiddle::j2s", opts.Verbose)
300
316
// clis.Verbose(1, "Doing J2s, with %+v, %+v", opts, args)
301
- // fmt.Println(x.FmtType, x.Filei, x.Fileo, x.Name, x.Pkg, x.SubStruct)
317
+ // // fmt.Println(x.FmtType, x.Filei, x.Fileo, x.Name, x.Pkg, x.SubStruct)
302
318
// return x.Exec(args)
303
319
// }
304
320
//
305
- // Exec implements the business logic of command `j2s`
321
+ // // Exec implements the business logic of command `j2s`
306
322
// func (x *J2sCommand) Exec(args []string) error {
307
323
// // err := ...
308
- // // clis.WarnOn("J2s, Exec", err)
324
+ // // clis.WarnOn("j2s:: Exec", err)
309
325
// // or,
310
- // // clis.AbortOn("J2s, Exec", err)
326
+ // // clis.AbortOn("j2s:: Exec", err)
311
327
// return nil
312
328
// }
313
329
// Template for "j2s" CLI handling ends here
@@ -342,8 +358,11 @@ type optsT struct {
342
358
//
343
359
// var x2jCommand X2jCommand
344
360
//
361
+ // ////////////////////////////////////////////////////////////////////////////
362
+ // // Function definitions
363
+ //
345
364
// func init() {
346
- // parser .AddCommand("x2j",
365
+ // gfParser .AddCommand("x2j",
347
366
// "XML to JSON",
348
367
// "",
349
368
// &x2jCommand)
@@ -354,16 +373,16 @@ type optsT struct {
354
373
// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
355
374
// clis.Setup("jsonfiddle::x2j", opts.Verbose)
356
375
// clis.Verbose(1, "Doing X2j, with %+v, %+v", opts, args)
357
- // fmt.Println(x.Filei, x.Fileo)
376
+ // // fmt.Println(x.Filei, x.Fileo)
358
377
// return x.Exec(args)
359
378
// }
360
379
//
361
- // Exec implements the business logic of command `x2j`
380
+ // // Exec implements the business logic of command `x2j`
362
381
// func (x *X2jCommand) Exec(args []string) error {
363
382
// // err := ...
364
- // // clis.WarnOn("X2j, Exec", err)
383
+ // // clis.WarnOn("x2j:: Exec", err)
365
384
// // or,
366
- // // clis.AbortOn("X2j, Exec", err)
385
+ // // clis.AbortOn("x2j:: Exec", err)
367
386
// return nil
368
387
// }
369
388
// Template for "x2j" CLI handling ends here
0 commit comments