Skip to content

Commit

Permalink
add quit command
Browse files Browse the repository at this point in the history
  • Loading branch information
name5566 committed Aug 14, 2015
1 parent af76846 commit 46f517e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 5 additions & 7 deletions console/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,15 @@ func (c *CommandHelp) name() string {
}

func (c *CommandHelp) help() string {
return "This help text"
return "this help text"
}

func (c *CommandHelp) run([]string) string {
output := "Commands:\r\n"
for i, c := range commands {
output += c.name() + " - " + c.help()
if i < len(commands)-1 {
output += "\r\n"
}
for _, c := range commands {
output += c.name() + " - " + c.help() + "\r\n"
}
output += "quit - exit console"

return output
}
Expand Down Expand Up @@ -164,7 +162,7 @@ func (c *CommandProf) name() string {
}

func (c *CommandProf) help() string {
return "Writes a pprof-formatted snapshot"
return "writes a pprof-formatted snapshot"
}

func (c *CommandProf) usage() string {
Expand Down
3 changes: 3 additions & 0 deletions console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func (a *Agent) Run() {
if len(args) == 0 {
continue
}
if args[0] == "quit" {
break
}
var c Command
for _, _c := range commands {
if _c.name() == args[0] {
Expand Down

0 comments on commit 46f517e

Please sign in to comment.