Example #1
0
File: bot.go Project: Zerak/micro
func Commands() []cli.Command {
	flags := []cli.Flag{
		cli.StringFlag{
			Name:  "inputs",
			Usage: "Inputs to load on startup",
		},
	}

	// setup input flags
	for _, input := range input.Inputs {
		flags = append(flags, input.Flags()...)
	}

	command := cli.Command{
		Name:   "bot",
		Usage:  "Run the micro bot",
		Flags:  flags,
		Action: run,
	}

	for _, p := range Plugins() {
		if cmds := p.Commands(); len(cmds) > 0 {
			command.Subcommands = append(command.Subcommands, cmds...)
		}

		if flags := p.Flags(); len(flags) > 0 {
			command.Flags = append(command.Flags, flags...)
		}
	}

	return []cli.Command{command}
}
Example #2
0
func Commands() []cli.Command {
	flags := []cli.Flag{
		cli.StringFlag{
			Name:  "inputs",
			Usage: "Inputs to load on startup",
		},
	}

	// setup input flags
	for _, input := range input.Inputs {
		flags = append(flags, input.Flags()...)
	}

	return []cli.Command{
		{
			Name:   "bot",
			Usage:  "Run the micro bot",
			Flags:  flags,
			Action: run,
		},
	}
}