Пример #1
0
func (c *Command) status() error {
	out, err := runCmd("launchctl", "list")
	if err != nil {
		return err
	}

	output := strings.Split(out, "\n")

	agents, err := agents.Find(c.pattern)
	if err != nil {
		return err
	}

	for _, line := range output {
		for _, agent := range agents {
			matched, err := regexp.MatchString(agent.Name, line)
			if err != nil {
				return err
			}

			if matched {
				printHeader(output[0])
				fmt.Println(line)
			}
		}
	}

	return nil
}
Пример #2
0
func (c *Command) list() error {
	agents, err := agents.Find(c.pattern)
	if err != nil {
		return err
	}

	for _, agent := range agents {
		if c.long {
			fmt.Println(agent.Fullpath)
		} else {
			fmt.Println(agent.Name)
		}
	}
	return nil
}