remove redundant Help field from Cmd struct
This commit is contained in:
parent
3ee37ccb43
commit
f63736fe14
|
@ -21,14 +21,13 @@ var buildCmd = &warren.Command{
|
|||
Name: "build",
|
||||
Usage: buildUsage,
|
||||
Summary: "build the go server in the current directory",
|
||||
Help: buildUsage,
|
||||
Run: buildRun,
|
||||
}
|
||||
|
||||
func buildRun(cmd *warren.Command, args ...string) {
|
||||
|
||||
if len(args) > 0 && args[0] == "help" {
|
||||
fmt.Print(cmd.Help)
|
||||
fmt.Print(cmd.Usage)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ var deployCmd = &warren.Command{
|
|||
Name: "deploy",
|
||||
Usage: deployUsage,
|
||||
Summary: "deploy the go server and support files",
|
||||
Help: deployUsage,
|
||||
Run: deployRun,
|
||||
}
|
||||
|
||||
|
@ -45,7 +44,7 @@ func cp(dst, src string) error {
|
|||
|
||||
func deployRun(cmd *warren.Command, args ...string) {
|
||||
if len(args) > 0 && args[0] == "help" {
|
||||
fmt.Print(cmd.Help)
|
||||
fmt.Print(cmd.Usage)
|
||||
return
|
||||
}
|
||||
dst := checkDeployDir()
|
||||
|
|
|
@ -13,7 +13,6 @@ var versionCmd = &warren.Command{
|
|||
Name: "version",
|
||||
Usage: versionUsage,
|
||||
Summary: "prints the current version",
|
||||
Help: versionUsage,
|
||||
Run: versionRun,
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ var regCmd = &warren.Command{
|
|||
Name: "reg",
|
||||
Usage: regUsage,
|
||||
Summary: "Register a deployment directory for running",
|
||||
Help: regUsage,
|
||||
Run: warrendRun,
|
||||
}
|
||||
|
||||
|
@ -29,7 +28,6 @@ var statusCmd = &warren.Command{
|
|||
Name: "status",
|
||||
Usage: statusUsage,
|
||||
Summary: "Get the status from the warrend server",
|
||||
Help: statusUsage,
|
||||
Run: warrendRun,
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ var regCmd = &SockCommand{
|
|||
Name: "reg",
|
||||
Usage: regUsage,
|
||||
Summary: "Register a deployment directory for running",
|
||||
Help: regUsage,
|
||||
},
|
||||
Run: regRun,
|
||||
}
|
||||
|
@ -24,7 +23,7 @@ var regCmd = &SockCommand{
|
|||
// reg path [nickname]
|
||||
func regRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
|
||||
if (len(args) > 0 && args[0] == "help") || len(args) < 1 {
|
||||
warren.WriteStringz(c, cmd.Help)
|
||||
warren.WriteStringz(c, cmd.Usage)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -15,14 +15,13 @@ var statusCmd = &SockCommand{
|
|||
Name: "status",
|
||||
Usage: statusUsage,
|
||||
Summary: "Print status of warrend",
|
||||
Help: statusUsage,
|
||||
},
|
||||
Run: statusRun,
|
||||
}
|
||||
|
||||
func statusRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
|
||||
if len(args) > 0 && args[0] == "help" {
|
||||
warren.WriteStringz(c, cmd.Help)
|
||||
warren.WriteStringz(c, cmd.Usage)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,9 @@ type Command struct {
|
|||
Run func(cmd *Command, args ...string)
|
||||
Flag flag.FlagSet
|
||||
|
||||
Name string
|
||||
Usage string
|
||||
|
||||
Summary string
|
||||
Help string
|
||||
Name string
|
||||
Usage string // multiline doc about using cmd
|
||||
Summary string // one line info about cmd
|
||||
}
|
||||
|
||||
func (c *Command) GetName() string {
|
||||
|
|
Loading…
Reference in New Issue