Fast shell prompt generator with daemon caching and multi-shell support.
- ANSI color and style support
- Template-based configuration (TOML)
- Daemon caching for expensive operations
- Multi-shell output (TCSH, Bash, Zsh)
- Implicit section creation
- Environment variable expansion
- Git branch display with graceful degradation
cargo build --release
cp target/release/twig ~/.local/bin/
cp target/release/twigd ~/.local/bin/twig # Boxed output with timingtwig --prompt # Raw ANSI codes
twig --mode tcsh # TCSH-specific format
twig --mode bash # Bash-specific format
twig --mode zsh # Zsh-specific formattwig --mode tcsh --debug # Show timing and config paths
TWIG_DEBUG=1 twig --mode tcsh # Or use environment variableDefault location: ~/.config/twig/config.toml
[prompt]
format = '''{time:cyan} {hostname:magenta} {cwd:green}
{"$":white,bold} '''
[time]
format = "%H:%M:%S"{variable} # Plain variable
{variable:color} # Colored variable
{variable:color,bold} # Colored and styled
{"text":color} # Literal colored text
{$ENV_VAR} # Environment variable
Sections are created automatically based on template variables.
# Using {time} creates [time] section implicitly
# Using {hostname} creates [hostname] section implicitly
# Using {cwd} creates [cwd] section implicitly
# Using {git} creates [git] section implicitlyOverride variable names:
[cwd]
name = "dir" # Use {dir} instead of {cwd}Twig automatically displays the current git branch in your prompt!
[prompt]
format = '{time:cyan} {git:yellow} {cwd:green} {"$":white,bold} 'No additional configuration needed - it just works:
- In a git repo: Shows current branch name
- Outside a git repo: Shows nothing (graceful degradation)
- Detached HEAD: Shows "HEAD"
- Git not installed: Shows nothing (no errors in normal mode)
Validation Mode
Check if git is working correctly:
twig --validateOutput:
✓ All providers validated successfully
If git is not installed or there are issues, validation mode will show detailed errors.
Future Enhancements (not yet implemented):
- Dirty status indicator (
git_dirty) - Commits ahead/behind remote (
git_ahead,git_behind)
# In ~/.tcshrc
set prompt="`twig --mode tcsh`"# In ~/.bashrc
PS1=$(twig --mode bash)# In ~/.zshrc
PROMPT=$(twig --mode zsh)Start the caching daemon for faster prompts:
twigd & # Runs in background, caches hostnameCache location: ~/.local/share/twig/data.json
Basic: black, red, green, yellow, blue, magenta, cyan, white Bright: bright_red, bright_green, bright_blue, etc. Styles: bold, italic, underline
twig/ CLI binary - generates prompts
twigd/ Daemon binary - caches expensive operations
docs/ Technical documentation
reference/ Example configurations
docs/FEATURES.md- Complete feature listdocs/FEATURES-CHECKLIST.md- Development roadmapdocs/TCSH.md- TCSH implementation plandocs/REFERENCE-mode-tcsh.md- TCSH technical reference
MIT