Add shared report format flag
This commit is contained in:
@@ -79,6 +79,7 @@ var reportingFlags = [...]Flag{
|
||||
{Name: "verbose", Usage: "show warning and informational messages", Default: "false", Boolean: true},
|
||||
{Name: "debug", Usage: "show debugging messages", Default: "false", Boolean: true},
|
||||
{Name: "progress", Usage: "show progress messages", Default: "false", Boolean: true},
|
||||
{Name: "format", Usage: "report format: text, yaml, or json", Completion: CompletionHint{Kind: CompletionChoices, Choices: []CompletionChoice{{Value: "text"}, {Value: "yaml"}, {Value: "json"}}}},
|
||||
}
|
||||
|
||||
// BooleanCompletion returns the ordinary explicit boolean suggestions.
|
||||
@@ -95,7 +96,11 @@ func HelpFlag() Flag {
|
||||
func ReportingFlags() []Flag {
|
||||
flags := append([]Flag(nil), reportingFlags[:]...)
|
||||
for index := range flags {
|
||||
flags[index].Completion = BooleanCompletion()
|
||||
if flags[index].Boolean {
|
||||
flags[index].Completion = BooleanCompletion()
|
||||
} else {
|
||||
flags[index].Completion.Choices = append([]CompletionChoice(nil), flags[index].Completion.Choices...)
|
||||
}
|
||||
}
|
||||
return flags
|
||||
}
|
||||
@@ -160,6 +165,7 @@ type ReportingSelection struct {
|
||||
Mode ReportingMode
|
||||
Progress bool
|
||||
ProgressSet bool
|
||||
Format string
|
||||
}
|
||||
|
||||
// Result contains the selected command and raw input collected by the adapter.
|
||||
|
||||
Reference in New Issue
Block a user