Skip to content

CLI Reference

Teyaotlani provides a command-line interface for making Spartan requests and running a server.

Installation

The CLI is included when you install teyaotlani:

uv add teyaotlani
# or
pip install teyaotlani

Commands

teyaotlani get

Fetch a resource from a Spartan server.

teyaotlani get [OPTIONS] URL

Arguments

Argument Description
URL Spartan URL to fetch (e.g., spartan://example.com/)

Options

Option Short Default Description
--timeout -t 30.0 Request timeout in seconds
--verbose -v false Show verbose output with headers

Examples

# Basic fetch
teyaotlani get spartan://example.com/

# With verbose output
teyaotlani get -v spartan://example.com/page.gmi

# With custom timeout
teyaotlani get -t 60 spartan://slow-server.com/

teyaotlani upload

Upload content to a Spartan server.

teyaotlani upload [OPTIONS] URL

Arguments

Argument Description
URL Spartan URL to upload to

Options

Option Short Default Description
--content -c Content to upload (string)
--file -f File to upload
--timeout -t 30.0 Request timeout in seconds
--verbose -v false Show verbose output

Content source

You must specify exactly one of --content or --file.

Examples

# Upload string content
teyaotlani upload spartan://example.com/file.txt -c "Hello, world!"

# Upload a file
teyaotlani upload spartan://example.com/doc.gmi -f document.gmi

# Upload with verbose output
teyaotlani upload -v spartan://example.com/data.txt -c "test data"

teyaotlani serve

Start a Spartan server to serve files.

teyaotlani serve [OPTIONS] [ROOT]

Arguments

Argument Description
ROOT Document root directory (required unless using --config)

Options

Option Short Default Description
--config -c Path to TOML configuration file
--host -H localhost Server host address
--port -p 300 Server port
--directory-listing -d false Enable directory listings
--log-level -l INFO Logging level (DEBUG, INFO, WARNING, ERROR)
--json-logs false Output logs in JSON format

Port 300 requires privileges

The default Spartan port (300) requires root/administrator privileges on most systems. Use --port 3000 or higher for development.

Examples

# Serve current directory
teyaotlani serve .

# Serve on a custom port
teyaotlani serve ./capsule --port 3000

# Enable directory listings
teyaotlani serve ./capsule -d -p 3000

# Use a configuration file
teyaotlani serve --config config.toml

# Debug logging
teyaotlani serve . -p 3000 --log-level DEBUG

teyaotlani version

Show version information.

teyaotlani version

Output

Teyaotlani - Spartan Protocol Client & Server
Version: 0.1.0
Protocol: Spartan (spartan://)
Default Port: 300

Named after the Nahuatl word for 'warrior'

Exit Codes

Code Meaning
0 Success
1 Error (invalid URL, connection error, server error response, etc.)

Environment Variables

Currently, Teyaotlani does not use any environment variables. All configuration is done via command-line options or TOML configuration files.