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