fix(cat): terminate string match options to handle --- frontmatter

A file whose first lines contain a bare '---' (e.g. YAML frontmatter)
caused 'string match -qr' to parse the line as an option flag, raising
'string match: ---: unknown option'. Add '--' to end option parsing.
This commit is contained in:
2026-06-17 22:14:31 -04:00
parent 3bdc712fa9
commit c7d1e642e5
+1 -1
View File
@@ -34,7 +34,7 @@ function cat --wraps='bat' --description 'Use bat for files, ls for directories,
# contains raw terminal ANSI color escape sequences.
if test -f $argv[1]
if string match -q "$SCROLLBACK_HISTORY_DIR/*" $argv[1]
or string match -qr '\e\[[0-9;]*m' (head -n 5 $argv[1] 2>/dev/null)
or string match -qr -- '\e\[[0-9;]*m' (head -n 5 $argv[1] 2>/dev/null)
command cat $argv
return
end