dagger do: Improve help message

- Only print first line of comment
- Add "Available Options" section header

Fixes #1777

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2022-03-11 11:32:29 -08:00
parent aacabb1393
commit ae4e61aaa1
4 changed files with 27 additions and 21 deletions

View File

@@ -128,13 +128,13 @@ func doHelpCmd(cmd *cobra.Command, _ []string) {
return
}
fmt.Println("")
fmt.Printf("\nAvailable Actions:\n")
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.StripEscape)
defer w.Flush()
for _, a := range action.Children {
if !a.Hidden {
lineParts := []string{"", a.Name, strings.TrimSpace(a.Comment)}
lineParts := []string{"", a.Name, a.Documentation}
fmt.Fprintln(w, strings.Join(lineParts, "\t"))
}
}