mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-25 11:43:40 +08:00
4cb19e244b
This addresses a long-standing TODO where `complete -C` output isn't deduplicated. With this patch, the same deduplication and sort procedure that is run on actual pager completions is also executed for `complete -C` completions (with a `-C` payload specified). This makes it possible to use `complete -C` to test what completions will actually be generated by the completions pager instead of it displaying something completely divorced from reality, improving the productivity of fish completions developers. Note that completions that wouldn't be shown in the pager are also omitted from the results, e.g. `test/buildroot/` and `test/fish_expand_test/` are omitted from the check matches in `checks/complete_directories.fish` because even if they were generated, the pager wouldn't have shown them. This again makes reasoning about and debugging completions much easier and more sane.
28 lines
792 B
Fish
28 lines
792 B
Fish
#RUN: %fish %s
|
|
mkdir -p __fish_complete_directories/
|
|
cd __fish_complete_directories
|
|
mkdir -p test/buildroot
|
|
mkdir -p test/fish_expand_test
|
|
mkdir -p test/data/abc
|
|
mkdir -p test/data/abcd
|
|
touch test/data/af
|
|
touch test/data/abcdf
|
|
mkdir -p test/data/xy
|
|
mkdir -p test/data/xyz
|
|
touch test/data/xyf
|
|
touch test/data/xyzf
|
|
__fish_complete_directories test/z
|
|
# No match - no output!
|
|
__fish_complete_directories test/d
|
|
#CHECK: test/data/ Directory
|
|
__fish_complete_directories test/data
|
|
#CHECK: test/data/ Directory
|
|
__fish_complete_directories test/data/
|
|
#CHECK: test/data/abc/ Directory
|
|
#CHECK: test/data/abcd/ Directory
|
|
#CHECK: test/data/xy/ Directory
|
|
#CHECK: test/data/xyz/ Directory
|
|
__fish_complete_directories test/data/abc 'abc dirs'
|
|
#CHECK: test/data/abc/ abc dirs
|
|
#CHECK: test/data/abcd/ abc dirs
|