U: upgrade command-line tool

This commit is contained in:
杨红岩 2023-08-20 21:51:12 +08:00
parent 23554bf6fc
commit 72f614b40e
3 changed files with 29 additions and 5 deletions

View File

@ -25,6 +25,7 @@ var commands = []*internal.Command{
internal.CmdSetenv,
internal.CmdEnv,
internal.CmdCreate,
internal.CmdBuild,
}
func main() {
@ -52,6 +53,8 @@ func main() {
cc.Index = 5
case "create":
cc.Index = 6
case "build":
cc.Index = 7
}
command := commands[cc.Index]
if len(extraArgs) < 1 || extraArgs[len(extraArgs)-1] != "." {

View File

@ -11,3 +11,20 @@
// 构建编译 energy 项目
package internal
var CmdBuild = &Command{
UsageLine: "build",
Short: "build energy project",
Long: `
Building energy project
. Execute default command
`,
}
func init() {
CmdBuild.Run = runBuild
}
func runBuild(c *CommandConfig) error {
return nil
}

View File

@ -19,6 +19,12 @@ type CommandConfig struct {
Setenv Setenv `command:"setenv"`
Env Env `command:"env"`
Create Create `command:"create"`
Build Build `command:"build"`
}
type Command struct {
Run func(c *CommandConfig) error
UsageLine, Short, Long string
}
type Install struct {
@ -46,10 +52,8 @@ type Version struct {
All bool `short:"a" long:"all" description:"show all"`
}
type Command struct {
Run func(c *CommandConfig) error
UsageLine, Short, Long string
}
type Create struct {
}
type Build struct {
}