mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
0a0149cc2a
Closes #7344 Apply a targeted fix to the place where complete() is called to handle nested variable assignments. Sadly, reporting an error is probably not okay here, because people might legitimately use aliases like: alias vim "A=B command vim" This is all a bit ugly, and I hope to find a cleaner solution. Supporting completions on commandlines like `x=$PWD cd $x/ ` is a nice feature but it comes with some complexity.
32 lines
950 B
Fish
32 lines
950 B
Fish
#RUN: %fish %s
|
|
# Validate some things about command wrapping.
|
|
|
|
# This tests that we do not trigger a combinatorial explosion - see #5638.
|
|
# Ensure it completes successfully.
|
|
complete -c testcommand --wraps "testcommand x "
|
|
complete -c testcommand --wraps "testcommand y "
|
|
complete -c testcommand --no-files -a normal
|
|
complete -C'testcommand '
|
|
# CHECK: normal
|
|
|
|
# We get the same completion twice. TODO: fix this.
|
|
# CHECK: normal
|
|
|
|
|
|
# This tests that a call to complete from within a completion doesn't trigger
|
|
# wrap chain explosion - #5638 again.
|
|
function testcommand2_complete
|
|
set -l tokens (commandline -opc) (commandline -ct)
|
|
set -e tokens[1]
|
|
echo $tokens 1>&2
|
|
end
|
|
|
|
complete -c testcommand2 -x -a "(testcommand2_complete)"
|
|
complete -c testcommand2 --wraps "testcommand2 from_wraps "
|
|
complete -C'testcommand2 explicit '
|
|
# CHECKERR: explicit
|
|
# CHECKERR: from_wraps explicit
|
|
|
|
|
|
complete -c recvar --wraps 'A=B recvar'
|
|
complete -C 'recvar '
|