Skip to main content

CLI Commands

Complete reference for Station command-line interface.

Global Flags

Available for all commands:

--config string      Path to config file (default: ~/.station/config.yaml)
--log-level string Log level: debug, info, warn, error (default: info)
--help, -h Show help
--version, -v Show version

station init

Initialize Station configuration.

station init [flags]

Flags

--force          Overwrite existing config file
--artist string Set artist name during initialization

Examples

# Create default config
station init

# Initialize with artist name
station init --artist my-artist-name

# Force overwrite existing config
station init --force

station start

Start the Station server.

station start [flags]

Flags

--port int              HTTP API port (default: 8080)
--libp2p-port int libp2p port (default: 4001)
--bootstrap strings Bootstrap peer multiaddrs
--music-dir string Music directory path

Examples

# Start with default settings
station start

# Start on custom port
station start --port 9000

# Start with custom music directory
station start --music-dir /mnt/music

# Start with debug logging
station start --log-level debug

station peers

Show connected peers.

station peers [flags]

Flags

--verbose, -v    Show detailed peer information
--json Output as JSON

Examples

# List connected peers
station peers

# Show detailed peer info
station peers --verbose

# Output as JSON
station peers --json

station stats

Display server statistics.

station stats

Output

Station Server Stats
├── Uptime: 2h 15m
├── Peers: 5
├── Albums: 3
├── Tracks: 28
├── Active Streams: 2
├── Total Bandwidth: 150MB
└── Memory Usage: 45MB

station albums

Manage albums.

station albums [command]

Subcommands

list              List all albums
add <path> Add album from directory
remove <id> Remove album by ID
refresh Refresh album metadata

Examples

# List all albums
station albums list

# Add new album
station albums add /path/to/album

# Remove album
station albums remove album-id-123

# Refresh all metadata
station albums refresh

station config

View and modify configuration.

station config [command]

Subcommands

show              Display current configuration
set <key> <val> Set configuration value
get <key> Get configuration value

Examples

# Show full config
station config show

# Set artist name
station config set artist.name my-artist

# Get server port
station config get server.port

station version

Show version information.

station version

Output

Station v1.0.0
Git commit: abc123def
Build date: 2024-02-14
Go version: go1.21.5
OS/Arch: linux/amd64

Environment Variables

Override config via environment variables:

STATION_CONFIG          Config file path
STATION_PORT HTTP API port
STATION_LIBP2P_PORT libp2p port
STATION_MUSIC_DIR Music directory
STATION_ARTIST_NAME Artist identifier
STATION_LOG_LEVEL Log level

Example

export STATION_PORT=9000
export STATION_LOG_LEVEL=debug
station start

Exit Codes

  • 0 - Success
  • 1 - General error
  • 2 - Configuration error
  • 3 - Network error
  • 4 - Storage error

Next Steps