A command-line interface tool for interacting with the RustMaps API, built in Go. The update-config
command is specifically designed to work with Rust Wipe Bot configuration files.
- CLI-based interface for easy interaction
- Downloads maps based on filter ID
- Updates Rust Wipe Bot config files with map seeds
- Handles pagination automatically
- Implements rate limiting to respect API constraints
- Creates backups of existing map data
- Stores maps data in JSON format
- Preserves YAML formatting and comments
- Go 1.21 or higher
- RustMaps API key
- RustMaps filter ID
Download the latest release for your platform from the Releases page.
Available platforms:
- Windows (32/64-bit)
- Linux (32/64-bit)
- macOS (Intel/Apple Silicon)
- Clone the repository:
git clone https://github.com/kWAYTV/rustmaps-downloader.git
cd rustmaps-downloader
- Make scripts executable (Linux only):
chmod +x scripts/*.sh
- Copy the example environment file and fill in your credentials:
cp .env.example .env
- Edit
.env
with your API credentials:
RUSTMAPS_API_KEY=your_api_key_here
RUSTMAPS_FILTER_ID=your_filter_id_here
# Build the CLI
scripts\build.bat
# Show help
scripts\help.bat
# Build the CLI
./scripts/build.sh
# Show help
./scripts/help.sh
After building with the build script:
- Get help and see available commands:
# Windows
rustmaps.exe --help
# Linux
./rustmaps --help
- Download maps using your filter:
# Windows
rustmaps.exe download
# Linux
./rustmaps download
- Update Rust Wipe Bot config with map seeds:
# Windows - Using relative paths
./rustmaps.exe update-config maps/rust_maps_[filter_id].json config.yml
# Windows - Using absolute paths (wrap in quotes if paths contain spaces)
./rustmaps.exe update-config "C:\Path\To\maps\rust_maps_[filter_id].json" "C:\Path\To\config.yml"
# Linux - Using relative paths
./rustmaps update-config maps/rust_maps_[filter_id].json config.yml
# Linux - Using absolute paths (wrap in quotes if paths contain spaces)
./rustmaps update-config "/path/to/maps/rust_maps_[filter_id].json" "/path/to/config.yml"
This command is designed to work with Rust Wipe Bot configuration files. It will update the world_seeds
section of your bot's config with the seeds from your downloaded maps while preserving all other settings, comments, and formatting.
Note: When using absolute paths with spaces or special characters, make sure to wrap them in quotes.
- Get help for a specific command:
./rustmaps [command] --help
The application creates a maps
directory and saves the fetched data in JSON format. Files are named with an incrementing counter to avoid overwriting:
- First run:
maps/rust_maps_[filter_id].json
- Second run:
maps/rust_maps_[filter_id]_1.json
- Third run:
maps/rust_maps_[filter_id]_2.json
And so on...
When using the update-config
command, it will update the specified YAML config file while preserving all comments and formatting, only modifying the world_seeds
section with the seeds from your maps JSON.
rustmaps-downloader/
βββ cmd/
β βββ rustmaps/
β βββ main.go # CLI entry point
β βββ commands/
β βββ root.go # Root command definition
β βββ download.go # Download command implementation
β βββ update-config.go # Config update command implementation
β βββ version.go # Version command implementation
βββ .env.example # Example environment file
βββ .env # Your environment file (git-ignored)
βββ README.md # This file
To add new functionality:
- Create a new file in
cmd/rustmaps/commands/
- Define your command using cobra
- Register it in the
init()
function
Example structure for a new command:
package commands
import "github.com/spf13/cobra"
var newCmd = &cobra.Command{
Use: "commandname",
Short: "Short description",
Long: `Longer description`,
Run: func(cmd *cobra.Command, args []string) {
// Command implementation
},
}
func init() {
RootCmd.AddCommand(newCmd)
}
- If you get API errors, verify your credentials in the
.env
file - Make sure Go is properly installed and in your system PATH
- For dependency issues, run
go mod tidy
The CLI supports shell autocompletion. To enable it:
# Linux
./rustmaps completion bash > /etc/bash_completion.d/rustmaps
# or locally
./rustmaps completion bash > ~/.rustmaps-completion.bash
source ~/.rustmaps-completion.bash
# Add to your PowerShell profile
rustmaps.exe completion powershell | Out-String | Invoke-Expression
# or temporarily
rustmaps.exe completion powershell > rustmaps.ps1
. .\rustmaps.ps1
# Add to your zshrc
./rustmaps completion zsh > "${fpath[1]}/_rustmaps"
# or locally
./rustmaps completion zsh > ~/.rustmaps-completion.zsh
source ~/.rustmaps-completion.zsh
./rustmaps completion fish > ~/.config/fish/completions/rustmaps.fish