Beispiel #1
0
func (t *Command) Execute(args shared.Args, reply *shared.Response) error {
	var commands []shared.Command

	update := shared.ExtractBool(args.Options["update"])
	if update {
		commands = append(commands, updateCommand())
	}

	commands = append(commands, installCommand(args))

	*reply = shared.NewResponse(commands...)

	return nil
}
Beispiel #2
0
func (t *Command) Execute(args shared.Args, reply *shared.Response) error {
	cmd := []string{
		"ping",
	}

	if count, ok := args.Options["count"]; ok {
		c := count.(float64)
		cmd = append(cmd, fmt.Sprintf("-c %v", c))
	}

	cmd = append(cmd, shared.ExtractString(args.Options["url"]))
	*reply = shared.NewResponse(shared.NewCommand(strings.Join(cmd, " ")))

	return nil
}
Beispiel #3
0
func (t *Command) Execute(args shared.Args, reply *shared.Response) error {
	directory := args.Options["directory"].(string)

	a := []string{
		"git",
		"clone",
		args.Options["repo"].(string),
		directory,
	}

	cmd := shared.NewCommand(strings.Join(a, " "))
	cmd.Unless(shared.DirectoryExists(directory))

	*reply = shared.NewResponse(cmd)

	return nil
}
Beispiel #4
0
func (t *Command) Execute(args shared.Args, reply *shared.Response) error {
	*reply = shared.NewResponse(shared.NewCommand("whoami"))

	return nil
}