examples

package
v0.0.0-...-69999d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 4 Imported by: 1

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
		}

		if len(args) == 0 || args[0] == "list" {
			for sn := range byShortName {
				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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL