fix(config_help): use string split -m 1 to extract line number and text

string split -f does not accept ranges like '2-'; split on the first
colon only with -m 1 to correctly separate the grep line number from
the heading text without erroring on every heading line.
This commit is contained in:
2026-06-06 03:40:43 -04:00
parent 63fc4bb6be
commit 12d83112ea
+3 -2
View File
@@ -42,8 +42,9 @@ function config_help --description 'Open the offline fish shell configuration ma
set -l norm_kw (string lower -- $argv[1] | string replace -ra '[^a-z0-9]' '')
set -l found ""
for entry in (grep -n "^#" "$doc_file")
set -l lnum (string split -f 1 ':' -- $entry)
set -l text (string split -f 2- ':' -- $entry)
set -l parts (string split -m 1 ':' -- $entry)
set -l lnum $parts[1]
set -l text $parts[2]
set -l norm_text (string lower -- $text | string replace -ra '[^a-z0-9]' '')
if string match -q "*$norm_kw*" $norm_text
set found $lnum