Skip to main content

Debug and Logging

When things aren't working as expected, these tools help you diagnose the issue.

Debug Logging

Enable debug output by setting the RUST_LOG environment variable:

RUST_LOG=debug ce expand ":hello"

This prints detailed information about:

  • Config file loading and parsing
  • Match file discovery and loading
  • Trigger matching process
  • Variable resolution steps
  • Form rendering
  • Shell command execution

Filtered Debugging

For focused debugging, filter by module:

# Only match-related logs
RUST_LOG=cli_expander_match=debug ce expand ":hello"

# Only config loading
RUST_LOG=cli_expander_config=debug ce expand ":hello"

# Only template rendering
RUST_LOG=cli_expander_render=debug ce expand ":hello"

Verbose Mode

Some commands support -v or verbose flags for additional output:

ce list -v # Show source file for each trigger
ce details ":x" # Already shows full details

Validate YAML Syntax

Invalid YAML is a common source of "match not found" errors. Validate your match files:

# Using Python
python3 -c "import yaml; yaml.safe_load(open('base.yml'))"

# Using yamllint (install via pip)
yamllint ~/.config/cli-expander/matches/base.yml

Check Config Paths

Verify cli-expander is looking in the right places:

ce config
# Config directory: /home/user/.config/cli-expander
# Config file: /home/user/.config/cli-expander/config.yml
# Shell plugins: bash, zsh, fish

Test Without Shell Integration

If expansion works with ce expand but not with shell keybindings, test directly:

# Works?
ce expand ":hello"
# Output: Hello World!

# If yes, the issue is in the shell plugin configuration
# If no, check your match files and config

Common Debug Scenarios

Shell Plugin Not Loading

# Check if plugin is sourced
type _cli_expander_on_space
# Expected: _cli_expander_on_space is a function
# If "not found", the plugin is not loaded

FZF Not Found

which fzf
# If not found: sudo apt install fzf (Debian/Ubuntu)
# or: sudo pacman -S fzf (Arch)

Clipboard Variable Fails

# X11
echo "test" | xclip -selection clipboard
xclip -selection clipboard -o
# Expected: test

# Wayland
echo "test" | wl-copy
wl-paste
# Expected: test

What's Next

  • Browse the FAQ for common questions
  • Check Common Errors for specific error messages