Fix code-review findings: 10-known.sh value-match bug (proven live), bootstrap.sh symlink race + missing sources + accidental exit-on-eval, fx.sh misleading picker text + FX_AUTO short-circuit
This commit is contained in:
@@ -2,8 +2,21 @@
|
||||
# Fuzzy-known source: surfaces fixes already taught for a command that
|
||||
# *starts the same way* as this one, since f()'s own p lookup only ever
|
||||
# matches the exact, literal string.
|
||||
#
|
||||
# Matches only against the KEY (left of "="), not the whole line -- an
|
||||
# earlier version used `grep -F "$first_word " p`, which also matched
|
||||
# inside a fix's *value*. Proven wrong live: with p containing
|
||||
# `gti --version=gti(){ command git "$@"; }`, querying "git push" (never
|
||||
# taught) matched that line anyway, because "git " appears inside the
|
||||
# value text, not because the key is related.
|
||||
[ -f p ] || exit 0
|
||||
cmd="$1"
|
||||
first_word=$(printf '%s' "$cmd" | awk '{print $1}')
|
||||
[ -n "$first_word" ] || exit 0
|
||||
grep -F "${first_word} " p 2>/dev/null | cut -d= -f2- | awk '!seen[$0]++'
|
||||
awk -v fw="$first_word " '
|
||||
substr($0, 1, length(fw)) == fw {
|
||||
line = $0
|
||||
sub(/^[^=]*=/, "", line)
|
||||
if (!seen[line]++) print line
|
||||
}
|
||||
' p 2>/dev/null
|
||||
|
||||
Reference in New Issue
Block a user