initial commit

This commit is contained in:
2021-10-21 02:51:32 +02:00
commit d9c1c42150
30 changed files with 1617 additions and 0 deletions

22
app/cmd/mode/list.go Normal file
View File

@ -0,0 +1,22 @@
package mode
import (
"github.com/urfave/cli/v2"
"ledo/app/modules/context"
)
var CmdModeList = cli.Command{
Name: "list",
Usage: "list run modes",
Description: `List modes defined in project config file`,
Action: RunModeList,
}
func RunModeList(cmd *cli.Context) error {
ctx := context.InitCommand(cmd)
ctx.Mode.PrintListModes()
return nil
}

27
app/cmd/mode/select.go Normal file
View File

@ -0,0 +1,27 @@
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
}