Guide for customizing padz CLI output: templates, styles, and rendering. Use when working on: (1) Modifying templates in crates/padz/src/cli/templates/, (2) Adding or changing styles in styles/default.yaml, (3) Debugging output with --output flag, (4) Adding new commands that need rendered output, (5) Understanding the outstanding crate integration.
Padz uses a three-layer system for CLI output, much like web appl, wher the api returns a data object, and the rendering system (using outstanding create) uses file based templates (minijinja) + styles to render:
.jinja files) - Define structure and layout--output flag)padz list --output=auto # Default: colors for TTY, plain for pipes
padz list --output=term # Force ANSI colors
padz list --output=text # Plain text, no colors
padz list --output=term-debug # Debug: shows [style-name]text[/style-name]
padz list --output=json # Machine-readable JSON
| Purpose | Location |
|---|---|
| Templates | crates/padz/src/cli/templates/*.jinja |
| Template registry | crates/padz/src/cli/templates.rs |
| Stylesheet | crates/padz/src/styles/default.yaml |
| Theme loading | crates/padz/src/cli/styles.rs |
| Rendering logic | crates/padz/src/cli/render.rs |
Templates use Minijinja syntax. Located in crates/padz/src/cli/templates/.
list.jinja - Pad list with columns, indentation, status iconsfull_pad.jinja - Complete pad view (title + content)text_list.jinja - Simple line-by-line outputmessages.jinja - Command feedback (success/error/info)_pad_line.jinja - Single row in list (included by list.jinja)_match_lines.jinja - Search result highlighting_peek_content.jinja - Content preview for --peek_deleted_help.jinja - Help text for deleted section{#- Whitespace-trimming comment -#}
{% for pad in pads %}
{{- pad.title | col(width) | style("list-title") | nl -}}
{% endfor %}
Key filters from outstanding:
col(width, align='left'|'right') - Column layoutstyle("name") - Apply semantic stylenl - Explicit newlinetruncate_to_width() - Truncate with ellipsisindent(n) - Add indentationCreate .jinja file in templates/ directory
Register in templates.rs:
pub const MY_TEMPLATE: &str = include_str!("templates/my_template.jinja");
Add to renderer in create_renderer():
renderer.add_template("my_template", MY_TEMPLATE)?;
Call from render function:
renderer.render("my_template", &data)?
Styles are defined in crates/padz/src/styles/default.yaml and embedded at compile time.
# Layer 1: Visual (internal, prefixed with _)
_gold:
light:
fg: [196, 140, 0]
dark:
fg: [255, 214, 10]
# Layer 2: Presentation (aliases)
_accent: _gold
# Layer 3: Semantic (use in templates)
list-index: _accent