From 15015a9d5b0a2642065e127588b5265fdeeb69dc Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Tue, 4 Jun 2019 14:45:55 +0000 Subject: [PATCH] rename command help to summary --- commands.go | 36 ++++++++++++++++++------------------ connection.go | 2 +- idle.go | 12 ++++++------ lobby.go | 6 +++--- mining.go | 4 ++-- travel.go | 8 ++++---- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/commands.go b/commands.go index 0813576..6039470 100644 --- a/commands.go +++ b/commands.go @@ -10,7 +10,7 @@ var commandRegistry map[string]*Command type Command struct { name string - help string + summary string arity int variadic bool handler func(*Connection, ...string) @@ -57,8 +57,8 @@ func (c CommandSet) Commands() []Command { } var helpCommand = Command{ - name: "help", - help: "helpful things to help you", + name: "help", + summary: "helpful things to help you", handler: func(conn *Connection, args ...string) { msg := ` Exocolonus is a game of cunning text-based, real-time strategy. You play as @@ -98,7 +98,7 @@ are farther away take longer to communicate with. conn.Printf("no such command: %v\n", cmdName) continue } - conn.Printf("%v: %v\n", cmdName, cmd.help) + conn.Printf("%v: %v\n", cmdName, cmd.summary) } }, } @@ -127,8 +127,8 @@ Location: {{.Location}} `)) var statusCommand = Command{ - name: "status", - help: "display your current status", + name: "status", + summary: "display your current status", handler: func(conn *Connection, args ...string) { conn.ConnectionState.PrintStatus(conn) }, @@ -137,14 +137,14 @@ var statusCommand = Command{ // this isn't a real command it just puts command in the list of commands, this // is weird and circular, this is a special case. var commandsCommand = Command{ - name: "commands", - help: "gives you a handy list of commands", + name: "commands", + summary: "gives you a handy list of commands", } func BroadcastCommand(sys *System) Command { return Command{ - name: "broadcast", - help: "broadcast a message for all systems to hear", + name: "broadcast", + summary: "broadcast a message for all systems to hear", handler: func(c *Connection, args ...string) { msg := strings.Join(args, " ") b := NewBroadcast(sys, msg) @@ -173,24 +173,24 @@ func NearbyCommand(sys *System) Command { } return Command{ name: "nearby", - help: "list nearby star systems", + summary: "list nearby star systems", arity: 0, handler: handler, } } var winCommand = Command{ - name: "win", - help: "win the game.", - debug: true, + name: "win", + summary: "win the game.", + debug: true, handler: func(conn *Connection, args ...string) { conn.Win("win-command") }, } var playersCommand = Command{ - name: "players", - help: "lists the connected players", + name: "players", + summary: "lists the connected players", handler: func(conn *Connection, args ...string) { for other, _ := range conn.game.connections { conn.Printf("%v\n", other.Name()) @@ -199,8 +199,8 @@ var playersCommand = Command{ } var balCommand = Command{ - name: "bal", - help: "displays your current balance in space duckets", + name: "bal", + summary: "displays your current balance in space duckets", handler: func(conn *Connection, args ...string) { fmt.Fprintln(conn, conn.money) }, diff --git a/connection.go b/connection.go index b8b030d..987c74e 100644 --- a/connection.go +++ b/connection.go @@ -84,7 +84,7 @@ func (c *Connection) ListCommands() { sort.Strings(names) for _, name := range names { cmd := c.GetCommand(name) - c.Printf("%-20s%s\n", name, cmd.help) + c.Printf("%-20s%s\n", name, cmd.summary) } c.Printf("\n") } diff --git a/idle.go b/idle.go index 158ab6b..c871419 100644 --- a/idle.go +++ b/idle.go @@ -20,37 +20,37 @@ func Idle(sys *System) ConnectionState { NearbyCommand(sys), Command{ name: "goto", - help: "travel between star systems", + summary: "travel between star systems", arity: 1, handler: i.travelTo, }, Command{ name: "bomb", - help: "bomb another star system", + summary: "bomb another star system", arity: 1, handler: i.bomb, }, Command{ name: "mine", - help: "mine the current system for resources", + summary: "mine the current system for resources", arity: 0, handler: i.mine, }, Command{ name: "info", - help: "gives you information about the current star system", + summary: "gives you information about the current star system", arity: 0, handler: i.info, }, Command{ name: "scan", - help: "scans the galaxy for signs of life", + summary: "scans the galaxy for signs of life", arity: 0, handler: i.scan, }, Command{ name: "make", - help: "makes things", + summary: "makes things", handler: i.maek, }, } diff --git a/lobby.go b/lobby.go index 84e4793..6fff04f 100644 --- a/lobby.go +++ b/lobby.go @@ -58,7 +58,7 @@ func (st *LobbyState) Enter(c *Connection) { time.Sleep(1 * time.Second) for { - c.Printf("\n\nwhat is your name, adventurer?\n") + c.Printf("\n\nWhat is your name, adventurer?\n") name, err := c.ReadString('\n') if err == nil { name = strings.TrimSpace(name) @@ -99,7 +99,7 @@ func (st *LobbyState) PrintStatus(c *Connection) { var newGameCommand = Command{ name: "new", - help: "starts a new game", + summary: "starts a new game", arity: 0, variadic: false, handler: func(c *Connection, args ...string) { @@ -118,7 +118,7 @@ var newGameCommand = Command{ var joinGameCommand = Command{ name: "join", - help: "joins an existing game", + summary: "joins an existing game", arity: 1, variadic: false, handler: func(c *Connection, args ...string) { diff --git a/mining.go b/mining.go index c9b7bf1..1ce0dcc 100644 --- a/mining.go +++ b/mining.go @@ -19,13 +19,13 @@ func Mine(sys *System) ConnectionState { NearbyCommand(sys), Command{ name: "stop", - help: "stops mining", + summary: "stops mining", arity: 0, handler: m.stop, }, Command{ name: "info", - help: "gives you information about the current mining operation", + summary: "gives you information about the current mining operation", arity: 0, handler: m.info, }, diff --git a/travel.go b/travel.go index efd11a5..67110ed 100644 --- a/travel.go +++ b/travel.go @@ -26,14 +26,14 @@ func NewTravel(c *Connection, start, dest *System) ConnectionState { balCommand, Command{ name: "progress", - help: "displays how far you are along your travel", + summary: "displays how far you are along your travel", arity: 0, handler: t.progress, }, Command{ - name: "eta", - help: "displays estimated time of arrival", - arity: 0, + name: "eta", + summary: "displays estimated time of arrival", + arity: 0, handler: func(c *Connection, args ...string) { c.Printf("%v\n", t.remaining()) },