ledo/app/cmd/mode/select.go

28 lines
526 B
Go
Raw Normal View History

2021-10-21 00:51:32 +00:00
package mode
import (
"github.com/urfave/cli/v2"
"ledo/app/modules/context"
"ledo/app/modules/interact"
)
var CmdModeSelect = cli.Command{
Name: "select",
Usage: "select run mode",
Description: `Select mode defined in project config file`,
ArgsUsage: "[<mode>]",
Action: RunSelectMode,
}
func RunSelectMode(cmd *cli.Context) error {
ctx := context.InitCommand(cmd)
if cmd.Args().Len() == 1 {
ctx.Mode.SetMode(cmd.Args().First())
return nil
}
interact.SelectMode(ctx, "")
return nil
}