Some options fixes

Add tests for bool type.
Fix subtle bug in TestOptionsApplyInvalid.
Fix options list formatting.
This commit is contained in:
DRON-666 committed 2020-12-23 23:26:04 +03:00
1 parent cb6b0f6255
commit 332b1896d1
2 files changed
+30 -8

No files matched your search

+7 -1
View File
@@ -23,8 +23,14 @@ Exit status is 0 if the command was successful, and non-zero if there was any er
DisableAutoGenTag: true,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("All Extended Options:\n")
var maxLen int
for _, opt := range options.List() {
fmt.Printf(" %-15s %s\n", opt.Namespace+"."+opt.Name, opt.Text)
if l := len(opt.Namespace + "." + opt.Name); l > maxLen {
maxLen = l
}
}
for _, opt := range options.List() {
fmt.Printf(" %*s %s\n", -maxLen, opt.Namespace+"."+opt.Name, opt.Text)
}
},
}