-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
CHANGELOG.v1
executable file
·916 lines (664 loc) · 28.9 KB
/
CHANGELOG.v1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# CHANGELOGS
## Versions
- v1.11.26 (FRZ)
- security patch: upgrade golang.org/x/crypto to 0.17.0
- v1.11.25 (FRZ)
- security patch: google/x/net and more
- upgrade deps
- v1.11.23 (FRZ)
- security patch: google/x/net and more
- improved some writings
- fixed/improved cmdr.Get() to extract some fields more deeply
- added Flag.GetDottedNamePathEx()
- improved defaultActionImpl to flush all outputs at once
- make default action outputs colorful
- v1.11.21 (FRZ)
- NOTE: switched toolchain to go1.18 (see the go.mod)
- now you may return `ErrNotImpl` to fallback to default action at early developing
- v1.11.20 (FRZ)
- upgrade deps
- v1.11.19 (FRZ)
- upgrade deps
- v1.11.18 (FRZ)
- upgrade deps
- v1.11.17 (FRZ)
- envvar `SUSPEND_WARNINGS`=1 can suspend warnings on conflict names found.
- fixed wrong xref built sometimes some cases
- new feature added: the abbr short name will be generated from its long name if short name not present. The first letters of each segment in a [`kebab-case`](https://en.wiktionary.org/wiki/kebab_case) long title name will be joint to a new name,
that is, from 'long-title-name' to 'ltn'.
Try `fluent xp -h` (=`fluent xy-print -h`).
- v1.11.16 (FRZ)
- upgrade deps
- v1.11.15 (FRZ)
- improve `detects` package in hedzr/log
- v1.11.13 (FRZ)
- fixed evendeep call
- v1.11.11 (FRZ)
- fixed evendeep calls
- fixed ds watch dead lock in coverage test
- added `WithNoWarning(b)`
- v1.11.9 (FRZ)
- upgrade `[hedzr/log](https:/github.com/hedzr/log)` to simplify error branch and log.Fatal
- security maintains
- added new `ExecOption`s: `WithIIfOpt(cond, true_opt, false_opt)` & `WithIfOpt(cond, true_opt)`
- v1.11.8 (FRZ)
- upgrade `hedzr/errors.v3` to compliant with go1.20+
- v1.11.7 (FRZ)
- upgrade `hedzr/evendeep`
- v1.11.6 (FRZ)
- upgrade `hedzr/evendeep`
- v1.11.5 (FRZ)
- replace old clone codes with `hedzr/evendeep`
- remove supports to go1.13 - go1.16 since our go.mod can't work for them after upgrade `golang/x` packages.
- v1.11.2 (FRZ)
- improved build-info output to add blank line after header printed
- fixed incorrect tail args while passthru switches `--` found
- update `sbom`
- upgrade deps for fixing `GetExecutablePath()` wrong return if user typing naked command in shell
- v1.11.1 (FRZ)
- improved version string output
- improved build-info output (via `app -#`)
- added new building strings for devops build-tool: `BuilderComments`, ...
- v1.11.0 (FRZ)
- improved code style
- `--version`: strip duplicated "v"
- improved `sbom` subcommand
- fixed data race in continuous coverage testing without completely cleanup
- v1.10.50 (FRZ)
- routine maintenance release
- upgrade log & logex, update project files and some godoc
- v1.10.49 (FRZ)
- NOTE: we declared a go1.18 Module in go.mod.
- fea: added a missed API: `NewAny(defval any)`
- fea: added `NewTextVar(defval TextVar)` for a given default value which implements `encoding.TextMarshaler` and `encoding.TextUnmarshaler`, such as `*net.IP`, `time.Time`, and so on.
- allow parsing a timestamp string with free styles
- imp: better `defaultActionImpl()`
- fea: added a missed API: `SetRawOverwrite(key, val)`
- fea: added `sbom` builtin Command for dumping SBOM (`Software Bill Of Materials`) Information (no need to install go runtime and run `go version -m app`) while u build the app with go1.18+
- fix: `~~debug` or its sub-flags can't work as expected sometimes
- fix: feature default action and `FORCE_DEFAULT_ACTION`
- fix: randomizer codes
- fix: fluent example app
- using new .editorconfig file and new deps.
- v1.10.48
- upgrade yaml.v3 to cut off Dependabot alerts
- v1.10.47
- fea: added tiny html code supports for tail-line (`cmdr.WithHelpTailLine(line)`).
> html in Description, Examples works too.
- more godoc
- lots of lint and review
- wrap ioutil/os.ReadFile and similar functions for crossing go111-118, with hedzr/log.dir.ReadFile...
- v1.10.40
- imp: parse the flag switch chars better
- fix: dead-loop for positional args starts with '~/'
- fea: FORCE_DEFAULT_ACTION for initial time, prints info with builtin defaultAction even if the valid command Action found.
- imp: improved many godoc and code completion tips
- imp: lint with golangci-lint now (...).
- v1.10.35
- fix nil exception while print error sometimes
- v1.10.33
- routine maintenance release
- v1.10.32
- fix: processing terminated too fast if global pre-actions return nil
- v1.10.31
- routine maintenance release
- v1.10.30
- routine maintenance release
- add: examples/example-app
- imp: use relative path in log output
- reenable error template
- v1.10.29
- routine maintenance release
- v1.10.27
- upgrade to errors.v3
- v1.10.24
- fix: version command, help screen not work
- v1.10.23
- fix: unknown switch char not an error now
- imp: refined gen zsh code, and gen shell codes
- fea: support fish-shell completion generating now
- fea: added root.`RunAsSubCommand`, treat 'app' as a synonym of 'app subcmd1 subcmd2'
- imp/fix/fea: clarify the slice append or replace mode - SetNx & `SetNxOverwrite` for Option Store
- fea: added `VendorHidden` field for when you wanna a never shown flag or command
- fea: conf package - add `Serial`, `SerialString` for CI tool
- imp: erase man1 folder after `--man`
- fix/imp: prints description with color escaped, when multiline
- fix: restore Match() but with new name MatchAndTest()
- fix: high-order fn hold the older copy, so pass it by holding a pointer to original variable
- imp: review most of the tests
- NOTE: cleanup the deprecated codes [`cmd.NewFlagV`,`cmd.NewFlag`, `cmd.NewSubCommand`, ...]
- fea: more completion supports
- v1.10.19
- temporary build for earlier testing
- confirmed: backward compatible with go1.12
- v1.10.13
- fix/imp: adapt windir to *nix name to fit for generic config file loading
- fea/imp: improved Aliases algor, support more tmpl var substitute
- fix: fallback the unknown type as string type
- fea: add flag to control whether write the changes back to alternative config file or not, `WithAlterConfigAutoWriteBack`
- imp: name/desc fields of builtin commands and flags
- v1.10.11
- fix: setNx bug at last commit
- fix: send 1.10.10 failure
- v1.10.9
- fix: setNx with slices merging
- fix: aliases might be added to multiple groups
- fea: secondary config file locations
- v1.10.8
- fix/fea/imp: make cmdr aliases subsystem better
- v1.10.7
- fix: generate shell may be lost buffered contents on writing to file
- v1.10.6
- fix: internal commands and flags has wrong group declarations since last refactored.
- fea: `-o file` for `generate shell` command.
- v1.10.5
- fix: logex might crash on a nil skip field
- v1.10.3
- last release failed because some deps cannot committed due to weak network
- v1.10.1
- move to go1.17 to get a split declaration
- fix: added the forgotten long-desc field
- fix: transfer proper log-level to hedzr/log if in debug/trace mode
- fix/imp: log.ForDir, ForFile
- fix: log.LeftPad
- fea: added InvokeCommand to run a sub-command from somewhere
- v1.10.0
- fix: toggle-group key not sync while set via envvar
- imp: speed up by extracting a re compiling code
- imp: upgrade deps with more enh-helpers from [hedzr/log](https://github.com/hedzr/log)
- imp: yaml indent size
- imp: StripOrderPrefix
- imp/fix: sync debug/trace mode back to hedzr/log
- fix: options after tail args (positional args) might be ignored
- fix: ResetOptions not clean up internal hierarchy-list
- fea: added `Checkpoints` on _Option Store_
you may save and restore multiple checkpoints for cmdr _Option Store_, so that some temporary changes can be made.
- fix/imp: `--man` crashes if manpages not installed - the responding manpage will be generated temporarily and instantly now
- add `GitSummary` field into conf package
- imp: speed up by reduce get worker
- centralize rxxtOptions to store()
- flatten backtrace(Flg|Cmd)Names, added dottedPathToCommand
- **NOTE**: _the phrase wrapped by backtick(````) in `Description` field will be extracted as `DefaultValuePlaceholder` field automatically, so **beware** this feature._
- fea: `-vv` (dup `-v` more than once) will print the hidden commands & flags in help screen NOW.
To take a sight of running `fluent generate --help --verbose -verbose`.
- ...
- v1.9.9
- improved: prevent `sent to closed channel` defensively
- SPECIAL: needs go1.16+ because some dep-lib wants io/fs (such as .../toml, zap ...).
- v1.9.8
- upgrade log and logex
- added DebugOutputTildeInfo()
- v1.9.7
- fixed: dead-lock while setting up env keys
- v1.9.6
- fixed: incorrect rune count at calc escaped text in help screen.
> help screen might not work properly in a small terminal window
- remove deprecated internal options: `--help-zsh`, `--help-bash`
- add new option `--man` to enter manpage entry of a sub-command, try `fluent ms tags ls --man`. [linux/darwin only]
- fixed: Flag.Action return err but cmdr.Exec no breaking its flow.
- v1.9.5
- **improved**: zsh completion generator (`app gen sh --zsh/--auto`) - supports unlimited nested sub-command now.
- fixed: single quote in desc string,
- fixed: don't quote in mutual exclusive section
- fixed: both short and long titles in mutual exclusive section
- v1.9.4
- fixed: potential nil exception while writing back to the alternative config files
- fixed: wrong calculating on remain args sometimes
- improved: rewrote builtin options constructions
- added 'cmdr.version' into Option Store
- added some tool helpers
- **improved**: zsh completion generator (app gen sh --zsh/--auto)
- v1.9.3
- fixed: commands might not work when loading from config file. ref: `fluent services kx3`, and/or `fluent ls/pwd`
- fixed: incorrect usage on bytes.Buffer, for toggle-group choicer
- v1.9.2:
- fixed: parsing not stop while a should-be-stopped flag (such as --version) found
- fixed: incorrect usage line at top level help screen
- improved: better toggle-group show in help screen
new style for ToggleGroup items: A unicode character '⬡'(U+2B21) as the prefix of the option description. (see [here](https://github.com/hedzr/cmdr/issues/1#issuecomment-968247546))
- improved: better toggle-group choicer in help screen
1. '⬢'(U+2B22) & '⬡'(U+2B21) for the default choicer style (named as `hexagon`),
1. '▸'(U+25B8) & '▹'(U+25B9) as another one (`triangle-right`),
- improved: `WithToggleGroupChoicerStyle(style)` and `WithToggleGroupChoicerNewStyle(style, trueChoicer, falseChoicer)`.
- v1.9.1:
- A public template repo may simplify your new CLI app: [**cmdr-go-starter**](https://github.com/hedzr/cmdr-go-starter).
- crashed at an elder fsnotify on macOS, with go1.17
- minor fixes
- v1.9.0
- .fossa.yaml so a pre-release scan can be launched locally
- BREAK: remove plugin/daemon - use cmdr-addons/pkg/plugins/dex instead
- updated `log`, added: closers, detects and more
- use `closers` for better closing hooks
- just a early BREAK release
- v1.8.7
- updated `log`, added: AutoStart Peripheral interface
- v1.8.5
- updated `log`, fixed: forwarding systemd log to file
- v1.8.2
- compliant with plan9,bsd,...
- some data racing PRBs in parallel testing
- v1.8.1
- fixed the CI error by imported from `log`
- fixed a data racing in config files watching
- small imp: pprof - added validArgs for cmdr-opt `profiling-type`
- update deps: log & logex(logrus indirect, ...)
- v1.8.0
- BREAK: removed support to golang 1.11 and below
- update deps: log & logex(logrus indirect, ...)
- v1.7.47
- BREAK: removed support to golang 1.11 and below
- update deps: log & logex(logrus indirect, ...)
- v1.7.46
- added `plugin/pprof` package to simplify pprof integration
- slight improvements
- v1.7.45
- upgrade hedzr/log to 0.3.12 for api upgrade and additions.
- v1.7.43
- added `WithConfigFileLoadingHooks(before, after)`
- added `WithLogxShort(enabled, backend, level)`
- some internal fixes
- v1.7.42
- routine maintenance
- v1.7.41
- fixed: flags after tail-args might not be recognized.
NOTE: in `app cmd1 cmd2 --a file1 file2 --c`, `--c` might be ignored.
- updated: log+logex
- v1.7.40
- update log/logex to fix the wrong caller skips for logrus
- v1.7.39
- update log/logex to fix the wrong caller skips for zap/sugar, and ensure debug mode work
- v1.7.38
- improved the usage line in help screen
- v1.7.37
- added `WithAlterLocations(...)`. The config files in the alternative locations have the topest priorities on loading and merging, and the first of them can be written back if the changes made programmatically.
The typical alternative locations are:
```
"./bin/$APPNAME.yml", // for developer, current bin directory
"/var/lib/$APPNAME",
"$THIS/$APPNAME.yml", // executable's directory
```
- broken: LoadConfigFiles returns 3 values now
- v1.7.36
- fixed `GetSectionFrom()` now work for []interface{}. such as:
```yaml
inform:
- name: xx
url: xx
- name: yy
url: yy
```
- print error detail while loading and merging child config file failed
- v1.7.35
- update deps with log/logex fixed
- v1.7.33
- added project-level files
- update deps
- v1.7.32
- added WithWarnForUnknownCommand
- fixed bugs
- v1.7.31
- added alternative config file and folder: `$CURRDIR/.<appname>.yml` & `$CURRDIR/.<appname>/*.yml` - Using `WithSearchAlterConfigFiles(true)`
- configurable auto-sub-folder-name `conf.d`: `WithConfigSubDirAutoName(string)`
- v1.7.30
- added docker hub image for examples/fluent
- v1.7.29
- added docker image for examples/fluent
- added cmdr.InDockerEnv
- small fixes
- v1.7.28
- added cmdr.NewLoggerConfigWith for better smoothing transfer cmdr internal status to log/logex.
- added cmdr.InDevelopingTime
- better output in PassThruChar(--) detected
- doc and added SetTraceMode/SetDebugMode
- v1.7.27
- added: `WithHelpScreenHooks`, `GetRemainArgs`, ...
- improved: `WithPagerEnabled`, `InTesting`, ...
- fixed: missed initializing for `logger-level` in `Option Store` sometimes.
- tests
- v1.7.25
- New feature: loading command definition from config file
- fixed bugs
- v1.7.23
- A new feature: the builtin pluggable cmdr-addon/plugin.
`make build && bin/fluent --help && bin/fluent dx`
- added: `WithPluginLocations(locations...)`, `WithExtensionsLocations(locations...)`
- v1.7.21
- new feature: the builtin pluggable extensions (see also: [cmdr-examples/flags](https://github.com/hedzr/cmdr-examples/blob/master/examples/flags/README.md#pluggable-extensions) )
- v1.7.11
- update: new log.Logger instance in log.GetLogger
- fixed: ReadPassword in windows
- v1.7.10
- fixed: too much empty lines in help screen
- v1.7.9
- right align multi-lines desc string in help screen
- added new envvars: HELP, NO_COLOR (`HELP=1 app some sub cmd` == `app some sub cmd --help`)
- v1.7.8
- tabStop in help screen will be autosize now
- *deprecated* at next minor release (v1.8+): `WithHelpTabStop()`
- *deprecated* at next minor release (v1.8+): plugins/daemon
- **BREAK**: some two methods in the interface `Painter` has been changed.
- v1.7.7
- update deps to improve logging supports
- *deprecated*: `WithLogex()``, as its replacement, `WithLogx()` has a better generic logging interface (hedzr/log.Logger)
- v1.7.6:
- using hedzr/log and remove other logging dependencies.
- added `WithLogx(logger)`
- v1.7.5:
- move some helper function to `tool` sub-package
- v1.7.3
- update dependencies to new logger packages
- v1.7.2
- update dependencies to new logger packages
- v1.7.1
- update dependencies to new logger packages
- v1.7.0
- adds `AddGlobalPreAction(pre)`, `AddGlobalPostAction(post)`
- using logex v1.2.0 and new logging switching framework
- added more logging output in trace mode enabled
see also: GetTraceMode(), GetDebugMode(), InDebugging(), and logex.GetTraceMode().
- more...
- v1.6.51
- deprecated: daemon plugin
- implements the required flag logic
- v1.6.50
- fixed: correct the error printing while wrong args got
- fixed: valid-args - ensure the `found` flag as a value matched
- fixed: withIgnoredMessage - format with liveArgs
- cmd.NewFlagV was deprecated since v1.6.50, we recommend the new form: `cmdr.NewBool(false).Titles(...)...AttachTo(ownerCmd)`
- better `Titles(long, ...)` and `Name(name)`
Now you can compose the order prefix easily: with `.Titles("001.start")`, we can recognize the prefix and move it to `Name` field automatically.
- v1.6.49
- added: Name() for command & flag defining
- v1.6.48
- code reviewed
- maintained
- unnecessary deps removed.
- small fixes
- v1.6.47
- fixed/improved: reset slice value if an empty slice was been setting
- improved: add logging output in delve debugging mode
- fixed: matching the longest short flag for combining flags
- **BROKEN API**: the param `defaultValue` is optional now: cmdr.NewBool(), cmdr.NewInt(), ...
- added `cmdr.NewUintSlice()`
- v1.6.45
- fixed/improved: `ToBool(value, defval...) bool`
- fixed: flag.OnSet trigger for envvar hit
- fixed/improved: friendly error msg
- v1.6.43
- fixed/improved: matching algorithm and remained args
- v1.6.41
- `WithPagerEnabled()`: enables OS pager for help screen output
- v1.6.39
- **BROKEN API**: the params order exchanged, their new prototypes are `OptFlag.Titles(long, short, aliases)` and `OptCmd.Titles(long, short, alases)`.
- improved help screen
- bug fixed:
- the value of remained args could be wrong sometimes
- stop flag split in parsing
- some coverage test errors
- v1.6.36
- `ToggleGroup`:
- assume the empty Group field with ToggleGroup
- set "command-path.toggleGroupName" to the hit flag full name as flipping a toggle-group.
For example, supposed a toggle-group 'KK' under 'server' command with 3 choices/flags: apple, banana, orange. For the input '--orange', these entries will be set in option store:
`server.orange` <== true;
`server.KK` <== 'orange';
- fixed: `GetStringSliceXxx()` return the value array without expand the envvar.
- improved: some supports for plan9
- fixed: can't expand envvar correectly at earlier initializing.
- v1.6.35
- routine maintenance: take effects with bug fixed of logex, typo, etc.
- typo, doc
- fixed a data racing scene: the fs-watcher and build-auto-env [rarely]
- v1.6.33
- fixed the wrong prototype for nacl/plan9
- v1.6.32
- routine maintenance
- downward compatibility: to go1.11
- enable github actions
- v1.6.31
- routine maintenance: take effects with bug fixed of logex, and so on.
- v1.6.26
- improved and fixed deep clone algor..
- v1.6.25
- wrap the logrus Level and expand it
- *NOTE that `cmdr.WithLogex(level)` has slight change.*
- fixed: logger-level extraction not work
- adds `flag.WithEnvKeys`, add `optFlagImpl.EnvKeys`
- fixed `NewBool`,...: now you need the explicit `NewBool().AttachXXX()` to connect the new flag with an existed command.
- fixed: the defaultValue might not take effect sometimes.
- fixed: don't bring the minor error for sub-dir walking back to main caller.
- fixed: for the main config file, searching .yaml suffix too.
- v1.6.23 Spring Festival Release
- added flag EnvVars text to help screen
- for the builtin options, the corresponding envvars added
- update the examples with new style
- ...
- v1.6.22
- added global post-actions chain: `RootCommand.AppendPostActions`
- prototypes changed: `OptCmd.NewSubCommand` and `NewFlagV`, and `Description`
- fixed logex level parsing.
- ...
- v1.6.21
- bugs fixed
- added **complex** option:
- `cmdOpt.NewFlagV(3+4i)` to register a complex128 option
- `cmdr.GetComplex128XXX(...)` to extract it
- `cmdr.ParseComplex(s)`
- use yaml.v3, but it can't encode/decode complex data type
- use errors.v2 and rewrote `ErrorForCmdr`
- little chichi for daemon plugin
- WithEnvKeys, WithOnSet for `flag` package
- v1.6.20
- fixed build error
- v1.6.19
- added: `GetKibibytesXXX`, `GetKilobytesXXX`. with further info, run `go run ./examples/fluent kb --size --help`.
- added hot-reload feature for daemon plugin:
`bin/cmdr-http2 server [hot-restart|hot-relaod]` will restart the app, transfer the living listener to the child process without break it.
`SIGUSR2` has the same effect.
> `Daemon.OnRun()` broken.
- added: `Commnad.GetDottedNamePath`
### v1.6.18
- added: `WithOnSwitchCharHit`, `WithOnPassThruCharHit`
- bug fixed
- reviewing and refactoring
### v1.6.17
better supports to `flag` child package and migrating from stdline `flag`.
supports to shell prompt mode, see also new release of [`cmdr-http2`](https://github.com/hedzr/cmdr-http2), which demostrates how to integrate cmdr with go-prompt.
- `Match(cmdline, opts...)`: match the arguments line (no os.Args[0]).
- `WithNoCommandAction(bool)`
### v1.6.15
- patch to fix errors package
### v1.6.13
- bugs
- Added [`WithOptionMergeModifying`](https://github.com/hedzr/cmdr/blob/master/exec_with_options.go#L163), [`WithOptionModifying`](https://github.com/hedzr/cmdr/blob/master/exec_with_options.go#L173)
Now the changing/merging events could be hooked with a top-level watching point.
- Added `WithUnhandledErrorHandler()` to capture panics if necessary
### v1.6.11
- bugs fixed
- fixed the group of built-in cmds/flags,
- for sequence `-v5 -v`, the valid short option `-v5` will be reported as `can't be found`,
- infinite loop for parsing tight short flags
- for `GetStringR(keyPath, defaultValue)`, defaultValue can't applied to the key if it has an empty string value.
- ...
- **apis break**:
<details>
These apis adds default value as parameter, such as `NewBool(bool)...` now, instead of `NewBool()`:
- `NewBool(bool)`, `NewString(string)`,
`NewStringSlice([]string)`, `NewIntSlice([]int)`,
`NewInt(int)`, `NewUint(uint)`, `NewInt64(int64)`, `NewUint64(uint64)`, `NewFloat32(float32)`, `NewFloat64(float64)`,
`NewDuration(time.Duration)`,
</details>
- adds `WithHelpTailLine(line)` for the customizable dim tail line
### v1.6.9
- Adds `WithWatchMainConfigFileToo(bool)`
- v1.6.8 for a nacl bug
- Adds `PressEnterToContinue()`, `PressAnyKeyToContinue()`
- Adds `StripQuotes(s)`, `StripPrefix(s,p)`
- Fluent API: Since v1.6.9, deprecated `cmdopt.NewFlag(flagType)` will be replaced with `cmdopt.NewFlagV(defaultValue)`;
single `flagopt.Placeholder(str)` available too.
- `Flag.EnvVars` be available now. And `newFlagOpt.EnvKeys(keys...)` with same effect in Fluent API style.
- bugs fixed (better `InTesting()`)
#### v1.6.7
- v1.6.7
- `TrapSignalEnh()` and `TrapSignal()`, and `SignalQuitSignal`,...
- `InDebugging()`, isdelve (refer to [here](https://stackoverflow.com/questions/47879070/how-can-i-see-if-the-goland-debugger-is-running-in-the-program/47890273#47890273)) - To use it, add `-tags=delve`:
```bash
go build -tags=delve cli/main.go
go run -tags=delve cli/main.go --help
```
- example/fluent: howto attach `--trace`
- `GetStringNoExapndXxx()` for string option value extraction (no envvar expanding)
- more enhancements of Fluent API: `ToCommand`, `ToFlag`, `AttachToxxx`
- for `~~debug`:
```bash
bin/fluent --help ~~debug --raw --env --more
```
`--raw`: dump option value with golang format, without envvar expanding
`--env`: dump environment inside app
`--more`: other information dump
-
#### v1.6.5
- v1.6.5 - [logex](https://github.com/hedzr/logex) integration
#### v1.6.3
- v1.6.3
support option value auto-expand with os environment variables.
<details><summary>Relnotes</summary>
- add WithNoColor, WithStrictMode, WithNoEnvOverrides
- add WithLogex
- add WithAfterArgsParsed
- add DeleteKey
- GetXXX() supports optional default value(s) now
- add WithEnvVarMap
- lint, doc, bugs fixed, and enable `-race` testing
- add code owners file
~~v1.6.3 WIP: `Getxxx()` with defaultValues; `WithLogex()`; `WithAfterArgsParsed(fn)`; `WithNoEnvOverrides(b)`; `WithNoColor(b)`; `WithStrictMode(b)`; `DeleteKey(key)`~~;
</details>
#### v1.6.1
- The v1.6.1 released: those deprecated functions have been removed.
This is a bug-fixed version on v1.6.0
#### v1.5.5
- The v1.5.5 is last release that the **DEPRECATED functions** would be kept.
<details><summary>THE DEPRECATED FUNCTIONS</summary>
- Functions:
1. AddOnBeforeXrefBuilding()
1. AddOnAfterXrefBuilt()
1. SetInternalOutputStreams()
1. SetCustomShowVersion()
1. SetCustomShowBuildInfo()
1. PrintBuildInfo()
1. SetNoLoadConfigFiles()
1. SetCurrentHelpPainter()
1. SetHelpTabStop()
1. ExecWith()
1. SetUnknownOptionHandler()
1. SetInternalOutputStreams()
1. daemon.Enable()
- Global Variables:
1. EnableVersionCommands
1. EnableHelpCommands
1. EnableVerboseCommands
1. EnableCmdrCommands
1. EnableGenerateCommands
1. EnvPrefix
1. RxxtPrefix
1. ShouldIgnoreWrongEnumValue
</details>
- See also [Examples](#examples), and [cmdr-http2](https://github.com/hedzr/cmdr-http2) (a http2 server with daemon supports, graceful shutdown).
- Go Playground ready now, play `cmdr` at: https://play.golang.org/p/ieExm3V1Pcx
<!-- https://play.golang.org/p/KaOGWTYrmXB -->
wget-demo at playground: https://play.golang.org/p/wpEZgQGzKyt
demo with daemon plugin: https://play.golang.org/p/wJUA59uGu2M
#### v1.5.0
- Since v1.5.0, main entry `Exec()` uses `With Functional Options` style too:
<details>
<summary> Expand to source codes </summary>
```go
err := cmdr.Exec(rootCmd,
cmdr.WithXrefBuildingHooks(func(root *cmdr.RootCommand, args []string) {}, func(root *cmdr.RootCommand, args []string) {}),
cmdr.WithAutomaticEnvHooks(func(root *cmdr.RootCommand, opts *cmdr.Options) {}),
cmdr.WithEnvPrefix("CMDR"), // WithEnvPrefix("F","YY") == T_YY_xxx
cmdr.WithOptionsPrefix("app"), // cmdr.WithRxxtPrefix("app"),
cmdr.WithPredefinedLocations(nil),
cmdr.WithIgnoreWrongEnumValue(true),
cmdr.WithBuiltinCommands(true, true, true, true, true),
cmdr.WithInternalOutputStreams(nil, nil),
cmdr.WithCustomShowVersion(func() {}),
cmdr.WithCustomShowBuildInfo(func() {}),
cmdr.WithNoLoadConfigFiles(false),
cmdr.WithHelpPainter(nil),
cmdr.WithConfigLoadedListener(nil),
cmdr.WithHelpTabStop(70),
cmdr.WithUnknownOptionHandler(func(isFlag bool, title string, cmd *cmdr.Command, args []string) (fallbackToDefaultDetector bool) {
return true
}), // since v1.5.5
cmdr.WithSimilarThreshold(0.73), // since v1.5.5
cmdr.WithNoColor(true), // since v1.6.2
cmdr.WithNoEnvOverrides(true), // since v1.6.2
cmdr.WithStrictMode(true), // since v1.6.2
)
```
</details>
#### v1.0.x
- Since v1.0.3, we added compatibilities for migrating from go `flag`:
<details>
<summary> Migrate to `cmdr` from go `flag` </summary>
```go
// old code
package main
import "flag"
var (
serv = flag.String("service", "hello_service", "service name")
host = flag.String("host", "localhost", "listening host")
port = flag.Int("port", 50001, "listening port")
reg = flag.String("reg", "localhost:32379", "register etcd address")
count = flag.Int("count", 3, "instance's count")
connectTimeout = flag.Duration("connect-timeout", 5*time.Second, "connect timeout")
)
func main(){
flag.Parse()
// ...
}
```
to migrate it to `cmdr`, just replace the import line with:
```go
import (
// flag
"github.com/hedzr/cmdr/flag"
)
var (
serv = flag.String("service", "hello_service", "service name")
host = flag.String("host", "localhost", "listening host")
port = flag.Int("port", 50001, "listening port")
reg = flag.String("reg", "localhost:32379", "register etcd address")
count = flag.Int("count", 3, "instance's count")
connectTimeout = flag.Duration("connect-timeout", 5*time.Second, "connect timeout")
)
func main(){
flag.Parse()
// ...
}
```
if you wanna use the new features from `cmdr`, try `Withxxx`:
```go
import (
// flag
"github.com/hedzr/cmdr"
"github.com/hedzr/cmdr/flag"
)
var (
// uncomment this line if you like long opt (such as --service)
//treatAsLongOpt = flag.TreatAsLongOpt(true)
serv = flag.String("service", "hello_service", "service name",
flag.WithAction(func(cmd *cmdr.Command, args []string) (err error) {
return
}))
// ...
// WithTitles, WithShort, WithLong, WithAliases,
// WithDescription, WithExamples, WithHidden,
// WithGroup, WithDeprecated, WithToggleGroup,
// WithAction, WithDefaultValue,
// WithValidArgs, WithHeadLike, WithExternalTool,
// ...
)
```
</details>