mirror of
https://github.com/go-task/task.git
synced 2026-09-01 19:50:16 +02:00
The engine shipped opt-in behind --new-completion, with the old scripts still on --completion. That split was never released, so flip it now rather than carry a third flag through a deprecation later. --completion serves the engine wrappers; the hand-written scripts move to completion/legacy/ and stay reachable via --legacy-completion for a release or two. .goreleaser.yml needed to follow: it packages the static files from completion/ into the deb/rpm/apk contents and the Homebrew cask, so leaving it untouched would have shipped the engine to anyone running `eval "$(task --completion zsh)"` and the old scripts to everyone installing from a package. The paths it references are unchanged and now resolve to the wrappers. Its archive glob is narrowed at the same time, so the test harness under completion/tests/ stops being shipped in the release archives.
56 lines
1.7 KiB
Fish
Executable File
56 lines
1.7 KiB
Fish
Executable File
#!/usr/bin/env fish
|
|
# Smoke-tests how the fish wrapper routes each directive, via `complete -C`.
|
|
# Set up by run.sh: TASK_FIXTURE, and `task` on PATH = the binary under test.
|
|
|
|
cd $TASK_FIXTURE
|
|
source (dirname (status -f))/../fish/task.fish
|
|
|
|
set -g fails 0
|
|
|
|
function cands
|
|
complete -C $argv[1] | string split -f1 \t
|
|
end
|
|
|
|
function has # LABEL LINE VALUE
|
|
if contains -- $argv[3] (cands $argv[2])
|
|
echo " ok $argv[1]"
|
|
else
|
|
echo " FAIL $argv[1] — '$argv[3]' missing from: "(cands $argv[2])
|
|
set fails (math $fails + 1)
|
|
end
|
|
end
|
|
|
|
function hasnot # LABEL LINE VALUE
|
|
if contains -- $argv[3] (cands $argv[2])
|
|
echo " FAIL $argv[1] — '$argv[3]' should be absent"
|
|
set fails (math $fails + 1)
|
|
else
|
|
echo " ok $argv[1]"
|
|
end
|
|
end
|
|
|
|
echo "fish: :4 (NoFileComp) forwards candidates, offers no files"
|
|
has "candidate forwarded" 'task ' build
|
|
hasnot "no file fallback" 'task ' notes.txt
|
|
|
|
echo "fish: :16 (FilterDirs) offers directories only"
|
|
has "dir offered" 'task --dir ' sub/
|
|
hasnot "no plain file" 'task --dir ' notes.txt
|
|
|
|
echo "fish: :8 (FilterFileExt) filters by extension"
|
|
has "matching file" 'task --taskfile ' Taskfile.yml
|
|
hasnot "non-matching file" 'task --taskfile ' notes.txt
|
|
|
|
echo "fish: :0 (Default) falls back to files"
|
|
has "file offered" 'task build -- ' notes.txt
|
|
|
|
echo "fish: inline --flag=path keeps the --flag= prefix"
|
|
has "inline nested" 'task --taskfile=sub/' --taskfile=sub/nested.yml
|
|
hasnot "inline non-matching" 'task --taskfile=' --taskfile=notes.txt
|
|
|
|
if test $fails -ne 0
|
|
echo "fish: $fails failure(s)"
|
|
exit 1
|
|
end
|
|
echo "fish: all passed"
|