rename command help to summary

master
Jordan Orelli 5 years ago
parent aa6bd1ca9e
commit 15015a9d5b

@ -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)
},

@ -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")
}

@ -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,
},
}

@ -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) {

@ -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,
},

@ -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())
},

Loading…
Cancel
Save