Configuration

Cowser reads optional defaults from a TOML file and one environment variable.

Table of Contents

Config file location

The config file is ~/.config/neostore/cowser/config.toml. On Windows this is %USERPROFILE%\.config\neostore\cowser\config.toml. If it does not exist, built-in defaults are used. A commented template is in config.example.toml at the repo root.

mkdir -p ~/.config/neostore/cowser
# then edit ~/.config/neostore/cowser/config.toml

Keys

Key Type Default Meaning
color string cyan Default output color (see cowser --help).
cow string random Default animal by name, prefix, or index.
eyes string o o Default eyes for the {eyes} token.
mode string Preset eyes/tongue style (borg, dead, ...).
wrap int Word-wrap the message to this width.
cow_dir string Extra art-pack directory.
seed int Fixed random seed for reproducible output.
# ~/.config/neostore/cowser/config.toml
color = "green"
cow = "fish"
eyes = "o o"
mode = "dead"
wrap = 40
cow_dir = "~/my-cows"
# seed = 42

An invalid or unreadable config file is not fatal: Cowser prints a warning to stderr and falls back to defaults.

Precedence

Command-line flags always win over config values. The order is:

  1. Command-line flag (e.g. --color red)
  2. Config file value (e.g. color = "green")
  3. Built-in default (e.g. cyan)

Environment variables

Variable Meaning
COWSER_COWS Path-separator separated list of art-pack directories.

For example:

COWSER_COWS="$HOME/my-cows:$HOME/more-cows" cowser "hello from packs"

On Windows use ; as the separator:

$env:COWSER_COWS = "$HOME\my-cows;$HOME\more-cows"
cowser "hello from packs"

Art pack directories

Art packs are discovered from, in order:

  1. --cow-dir DIR on the command line,
  2. the COWSER_COWS environment variable,
  3. the cow_dir config key,
  4. ~/.config/neostore/cowser/cows/ by default.

Supported formats: classic cowsay .cow cowfiles and plain .txt/.art art text. Each file becomes a cow named after its file stem; duplicate names are skipped. See usage.md.


← Back to README