Update build path and docs.
This commit is contained in:
parent
6c1e0d9547
commit
8d764e1477
6 changed files with 36 additions and 33 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -5,6 +5,3 @@
|
||||||
|
|
||||||
# General
|
# General
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# Executable
|
|
||||||
battlesnake
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,18 @@
|
||||||
# Battlesnake CLI
|
# Battlesnake CLI
|
||||||
|
|
||||||
This tool allows running a Battlesnake game locally. There are several command-
|
This tool allows running a Battlesnake game locally. There are several command-line options for running games, including the ability to send Battlesnake requests sequentially or concurrently, set a custom timeout, etc.
|
||||||
line options for the play verb, including the ability to send snakes requests
|
|
||||||
sequentially or all at the same time, and also to set a timeout limit.
|
## Installation
|
||||||
|
|
||||||
|
The Battlesnake CLI requires Go 1.13 or later.
|
||||||
|
|
||||||
|
```
|
||||||
|
go get github.com/BattlesnakeOfficial/rules/cli/battlesnake
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
Use the CLI to configure and play a game of Battlesnake against
|
|
||||||
multiple snakes, with multiple rulesets.
|
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
battlesnake play [flags]
|
battlesnake play [flags]
|
||||||
|
|
||||||
|
|
@ -29,19 +32,23 @@ Global Flags:
|
||||||
--config string config file (default is $HOME/.battlesnake.yaml)
|
--config string config file (default is $HOME/.battlesnake.yaml)
|
||||||
```
|
```
|
||||||
|
|
||||||
Names and URLs will be paired together in sequence, so in the following example
|
Battlesnake names and URLs will be paired together in sequence, for example:
|
||||||
it effectively makes:
|
|
||||||
|
|
||||||
* Snake1: http://snake1-url-whatever:port
|
|
||||||
* Snake2: http://snake2-url-whatever:port
|
|
||||||
|
|
||||||
Names are optional, but definitely way easier to read than UUIDs. URLs are
|
|
||||||
optional too, but your snake will lose if the server is only sending move
|
|
||||||
requests to http://example.com.
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
battlesnake play --width 7 --height 7 --name Snake1 --url http://snake1-url-whatever:port --name Snake2 --url http://snake2-url-whatever:port
|
battlesnake play --name Snake1 --url http://snake1-url-whatever --name Snake2 --url http://snake2-url-whatever
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a game with the following Battlesnakes:
|
||||||
|
* Snake1, http://snake1-url-whatever
|
||||||
|
* Snake2, http://snake2-url-whatever
|
||||||
|
|
||||||
|
Names are optional, and if you don't provide them UUIDs will be generated instead. However names are way easier to read and highly recommended!
|
||||||
|
|
||||||
|
URLs are technically optional too, but your Battlesnake will lose if the server is only sending move requests to http://example.com.
|
||||||
|
|
||||||
|
Example creating a 7x7 Standard game with two Battlesnakes:
|
||||||
|
```
|
||||||
|
battlesnake play --width 7 --height 7 --name Snake1 --url http://snake1-url-whatever --name Snake2 --url http://snake2-url-whatever
|
||||||
```
|
```
|
||||||
|
|
||||||
### Sample Output
|
### Sample Output
|
||||||
|
|
|
||||||
7
cli/battlesnake/main.go
Normal file
7
cli/battlesnake/main.go
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "github.com/BattlesnakeOfficial/rules/cli/commands"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
commands.Execute()
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package cmd
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
@ -93,9 +93,8 @@ var ViewMap bool
|
||||||
|
|
||||||
var playCmd = &cobra.Command{
|
var playCmd = &cobra.Command{
|
||||||
Use: "play",
|
Use: "play",
|
||||||
Short: "Play a game of Battlesnake",
|
Short: "Play a game of Battlesnake locally.",
|
||||||
Long: `Use the CLI to configure and play a game of Battlesnake against
|
Long: "Play a game of Battlesnake locally.",
|
||||||
multiple snakes, with multiple rulesets.`,
|
|
||||||
Run: run,
|
Run: run,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package cmd
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import "github.com/BattlesnakeOfficial/rules/cli/cmd"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
cmd.Execute()
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue