@@ -34,27 +34,31 @@ import (
3434// opts optsT
3535// )
3636//
37- // var parser = flags.NewParser(&opts, flags.Default)
37+ // var gfParser = flags.NewParser(&opts, flags.Default)
3838
3939////////////////////////////////////////////////////////////////////////////
4040// Function definitions
4141
42+ //==========================================================================
4243// Function main
4344// func main() {
4445// opts.Version = showVersion
4546// opts.Verbflg = func() {
4647// opts.Verbose++
4748// }
4849//
49- // if _, err := parser .Parse(); err != nil {
50+ // if _, err := gfParser .Parse(); err != nil {
5051// fmt.Println()
51- // parser .WriteHelp(os.Stdout)
52+ // gfParser .WriteHelp(os.Stdout)
5253// os.Exit(1)
5354// }
5455// fmt.Println()
5556// //DoJsonfiddle()
5657// }
5758//
59+ // //==========================================================================
60+ // // support functions
61+ //
5862// func showVersion() {
5963// fmt.Fprintf(os.Stderr, "jsonfiddle - JSON Fiddling, version %s\n", version)
6064// fmt.Fprintf(os.Stderr, "Built on %s\n", date)
@@ -114,8 +118,11 @@ type optsT struct {
114118//
115119// var escCommand EscCommand
116120//
121+ // ////////////////////////////////////////////////////////////////////////////
122+ // // Function definitions
123+ //
117124// func init() {
118- // parser .AddCommand("esc",
125+ // gfParser .AddCommand("esc",
119126// "Escape json string",
120127// "",
121128// &escCommand)
@@ -126,16 +133,16 @@ type optsT struct {
126133// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
127134// clis.Setup("jsonfiddle::esc", opts.Verbose)
128135// clis.Verbose(1, "Doing Esc, with %+v, %+v", opts, args)
129- // fmt.Println(x.Filei, x.Fileo)
136+ // // fmt.Println(x.Filei, x.Fileo)
130137// return x.Exec(args)
131138// }
132139//
133- // Exec implements the business logic of command `esc`
140+ // // Exec implements the business logic of command `esc`
134141// func (x *EscCommand) Exec(args []string) error {
135142// // err := ...
136- // // clis.WarnOn("Esc, Exec", err)
143+ // // clis.WarnOn("esc:: Exec", err)
137144// // or,
138- // // clis.AbortOn("Esc, Exec", err)
145+ // // clis.AbortOn("esc:: Exec", err)
139146// return nil
140147// }
141148// Template for "esc" CLI handling ends here
@@ -170,8 +177,11 @@ type optsT struct {
170177//
171178// var fmtCommand FmtCommand
172179//
180+ // ////////////////////////////////////////////////////////////////////////////
181+ // // Function definitions
182+ //
173183// func init() {
174- // parser .AddCommand("fmt",
184+ // gfParser .AddCommand("fmt",
175185// "Format json string",
176186// "",
177187// &fmtCommand)
@@ -182,16 +192,16 @@ type optsT struct {
182192// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
183193// clis.Setup("jsonfiddle::fmt", opts.Verbose)
184194// clis.Verbose(1, "Doing Fmt, with %+v, %+v", opts, args)
185- // fmt.Println(x.Filei, x.Fileo)
195+ // // fmt.Println(x.Filei, x.Fileo)
186196// return x.Exec(args)
187197// }
188198//
189- // Exec implements the business logic of command `fmt`
199+ // // Exec implements the business logic of command `fmt`
190200// func (x *FmtCommand) Exec(args []string) error {
191201// // err := ...
192- // // clis.WarnOn("Fmt, Exec", err)
202+ // // clis.WarnOn("fmt:: Exec", err)
193203// // or,
194- // // clis.AbortOn("Fmt, Exec", err)
204+ // // clis.AbortOn("fmt:: Exec", err)
195205// return nil
196206// }
197207// Template for "fmt" CLI handling ends here
@@ -226,8 +236,11 @@ type optsT struct {
226236//
227237// var sortCommand SortCommand
228238//
239+ // ////////////////////////////////////////////////////////////////////////////
240+ // // Function definitions
241+ //
229242// func init() {
230- // parser .AddCommand("sort",
243+ // gfParser .AddCommand("sort",
231244// "Sort json fields recursively",
232245// "",
233246// &sortCommand)
@@ -238,16 +251,16 @@ type optsT struct {
238251// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
239252// clis.Setup("jsonfiddle::sort", opts.Verbose)
240253// clis.Verbose(1, "Doing Sort, with %+v, %+v", opts, args)
241- // fmt.Println(x.Filei, x.Fileo)
254+ // // fmt.Println(x.Filei, x.Fileo)
242255// return x.Exec(args)
243256// }
244257//
245- // Exec implements the business logic of command `sort`
258+ // // Exec implements the business logic of command `sort`
246259// func (x *SortCommand) Exec(args []string) error {
247260// // err := ...
248- // // clis.WarnOn("Sort, Exec", err)
261+ // // clis.WarnOn("sort:: Exec", err)
249262// // or,
250- // // clis.AbortOn("Sort, Exec", err)
263+ // // clis.AbortOn("sort:: Exec", err)
251264// return nil
252265// }
253266// Template for "sort" CLI handling ends here
@@ -286,8 +299,11 @@ type optsT struct {
286299//
287300// var j2sCommand J2sCommand
288301//
302+ // ////////////////////////////////////////////////////////////////////////////
303+ // // Function definitions
304+ //
289305// func init() {
290- // parser .AddCommand("j2s",
306+ // gfParser .AddCommand("j2s",
291307// "JSON to struct",
292308// "JSON convert to Go struct",
293309// &j2sCommand)
@@ -298,16 +314,16 @@ type optsT struct {
298314// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
299315// clis.Setup("jsonfiddle::j2s", opts.Verbose)
300316// 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)
302318// return x.Exec(args)
303319// }
304320//
305- // Exec implements the business logic of command `j2s`
321+ // // Exec implements the business logic of command `j2s`
306322// func (x *J2sCommand) Exec(args []string) error {
307323// // err := ...
308- // // clis.WarnOn("J2s, Exec", err)
324+ // // clis.WarnOn("j2s:: Exec", err)
309325// // or,
310- // // clis.AbortOn("J2s, Exec", err)
326+ // // clis.AbortOn("j2s:: Exec", err)
311327// return nil
312328// }
313329// Template for "j2s" CLI handling ends here
@@ -342,8 +358,11 @@ type optsT struct {
342358//
343359// var x2jCommand X2jCommand
344360//
361+ // ////////////////////////////////////////////////////////////////////////////
362+ // // Function definitions
363+ //
345364// func init() {
346- // parser .AddCommand("x2j",
365+ // gfParser .AddCommand("x2j",
347366// "XML to JSON",
348367// "",
349368// &x2jCommand)
@@ -354,16 +373,16 @@ type optsT struct {
354373// // fmt.Fprintf(os.Stderr, "Copyright (C) 2017-2023, Tong Sun\n\n")
355374// clis.Setup("jsonfiddle::x2j", opts.Verbose)
356375// clis.Verbose(1, "Doing X2j, with %+v, %+v", opts, args)
357- // fmt.Println(x.Filei, x.Fileo)
376+ // // fmt.Println(x.Filei, x.Fileo)
358377// return x.Exec(args)
359378// }
360379//
361- // Exec implements the business logic of command `x2j`
380+ // // Exec implements the business logic of command `x2j`
362381// func (x *X2jCommand) Exec(args []string) error {
363382// // err := ...
364- // // clis.WarnOn("X2j, Exec", err)
383+ // // clis.WarnOn("x2j:: Exec", err)
365384// // or,
366- // // clis.AbortOn("X2j, Exec", err)
385+ // // clis.AbortOn("x2j:: Exec", err)
367386// return nil
368387// }
369388// Template for "x2j" CLI handling ends here
0 commit comments