exec

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "exec",
	Short: "Execute a list of tasks from a file",
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) > 0 {
			help.Show(cmd)
		}

		route, err := cmd.Flags().GetString(Flag.Config)

		if err != nil {
			handler.ExitByError(err)
		}

		data, err := read.File(route)

		if err != nil {
			handler.ExitByError(err)
		}

		var tasks *exec.Exec

		err = read.JSON(data, &tasks)

		if err != nil {
			handler.ExitByError(err)
		}

		for _, task := range tasks.Tasks {
			out.Print(log.Info, task.Title, task.Description)

			if err = Do(task); err != nil {
				out.Print(log.Error, task.Error)
				handler.ExitByError(err)
			}

			out.Print(log.Success, task.Success)
		}
	},
}
View Source
var Flag = &struct {
	Config, ConfigShort string
}{
	Config:      "config",
	ConfigShort: "c",
}

Functions

func Do

func Do(task *exec.Task) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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