Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Added
- `list` command alias for `ls`
- `TICKET_PAGER` environment variable for `show` command (only when stdout is a TTY; falls back to `PAGER`)

### Changed
- Walk parent directories to find `.tickets/` directory, enabling commands from any subdirectory
Expand Down
13 changes: 12 additions & 1 deletion ticket
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ init_tickets_dir() {
return 1
}

TICKET_PAGER="${TICKET_PAGER:-${PAGER:-}}"

# Prefer ripgrep if available, fall back to grep
if command -v rg &>/dev/null; then
_grep() { rg "$@"; }
Expand Down Expand Up @@ -1130,7 +1132,8 @@ cmd_show() {
local target_id
target_id=$(basename "$file" .md)

awk -v target="$target_id" -v target_file="$file" '
_show_output() {
awk -v target="$target_id" -v target_file="$file" '
BEGIN { FS=": "; in_front=0 }

# First pass: collect all ticket metadata
Expand Down Expand Up @@ -1262,6 +1265,14 @@ cmd_show() {
}
}
' "$TICKETS_DIR"/*.md 2>/dev/null
}

if [[ -t 1 && -n "$TICKET_PAGER" ]]; then
read -r -a pager_cmd <<<"$TICKET_PAGER"
_show_output | "${pager_cmd[@]}"
else
_show_output
fi
}

cmd_add_note() {
Expand Down