mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 03:01:15 -03:00
Fix funced to not expand or execute function name when interactive
Due to unnecessary quotes in the prompt command given to `read` by `funced` when editing a function interactively (using `-i`), the name of the function to edit would be evaluated, expanded and even executed (when using command substitution for example), which is at least annoying when using unusual but valid and allowed function names like '*' or 'head (cat)'. This commit delays the function name expansion so that this should no longer happen.
This commit is contained in:
@@ -47,7 +47,7 @@ function funced --description 'Edit function definition'
|
||||
functions --no-details -- $funcname | __fish_indent --only-unindent | __fish_indent --no-indent | read -z init
|
||||
end
|
||||
|
||||
set -l prompt 'printf "%s%s%s> " (set_color green) '$funcname' (set_color normal)'
|
||||
set -l prompt 'printf "%s%s%s> " (set_color green) $funcname (set_color normal)'
|
||||
if read -p $prompt -c "$init" --shell cmd
|
||||
echo -n $cmd | __fish_indent --only-unindent | read -lz cmd
|
||||
eval "$cmd"
|
||||
|
||||
Reference in New Issue
Block a user