Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "examples [name]", Aliases: []string{"example"}, Short: "Print example task messages.", RunE: func(cmd *cobra.Command, args []string) error { byShortName := map[string]string{} taskEx := ex.Examples() for n, v := range taskEx { byShortName[n] = v } confEx := config.Examples() for n, v := range confEx { byShortName[n] = v } keys := make([]string, 0, len(byShortName)) for k := range byShortName { keys = append(keys, k) } sort.Strings(keys) if len(args) == 0 || args[0] == "list" { for _, sn := range keys { fmt.Println(sn) } return nil } name := args[0] data, ok := byShortName[name] if !ok { return fmt.Errorf("No example by the name of %s", name) } fmt.Println(data) return nil }, }
Cmd represents the examples command
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.