diff --git a/command.go b/command.go index 26ba3b7..edddc14 100644 --- a/command.go +++ b/command.go @@ -14,9 +14,10 @@ type Command struct { Run func(cmd *Command, args []string) Flag flag.FlagSet - Usage string // first word is the command name - Short string // `forego help` output - Long string // `forego help cmd` output + Disabled bool + Usage string // first word is the command name + Short string // `forego help` output + Long string // `forego help cmd` output } func (c *Command) printUsage() { diff --git a/main.go b/main.go index 40baa74..89b3014 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,6 @@ package main -import ( - "os" -) +import "os" var commands = []*Command{ cmdStart, @@ -12,13 +10,22 @@ var commands = []*Command{ cmdHelp, } +var allowUpdate string = "true" + func main() { args := os.Args[1:] if len(args) < 1 { usage() } + if allowUpdate == "false" { + cmdUpdate.Disabled = true + } + for _, cmd := range commands { + if cmd.Disabled == true { + continue + } if cmd.Name() == args[0] && cmd.Run != nil { cmd.Flag.Usage = func() { cmd.printUsage()