mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
__fish_{filter,complete}_mime: drop from tree
These are undocumented and unused, and rely on mimedb which is being removed from the tree.
This commit is contained in:
parent
749b9182ab
commit
f77f71c17e
@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
function __fish_complete_mime -d "Complete using text files"
|
|
||||||
# Find all possible file completions
|
|
||||||
set -l all
|
|
||||||
set -l comp (commandline -ct)
|
|
||||||
set -l base (echo $comp | sed -e 's/\.[a-zA-Z0-9]*$//')
|
|
||||||
set -l mimetype $argv[1]
|
|
||||||
eval "set all $base*"
|
|
||||||
|
|
||||||
# Select text files only
|
|
||||||
set -l files (__fish_filter_mime $mimetype $all)
|
|
||||||
|
|
||||||
# Get descriptions for files
|
|
||||||
set desc (mimedb -d $files)
|
|
||||||
|
|
||||||
# Format completions and descriptions
|
|
||||||
if count $files > /dev/null
|
|
||||||
set -l res
|
|
||||||
for i in (seq (count $files))
|
|
||||||
set res $res $files[$i]\t$desc[$i]
|
|
||||||
end
|
|
||||||
|
|
||||||
if test $res[1]
|
|
||||||
printf "%s\n" $res
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# $argv[1] is a mimetype. The mimetype may contain wildcards. All
|
|
||||||
# following arguments are filenames. Filenames matching the mimetype
|
|
||||||
# are returned.
|
|
||||||
#
|
|
||||||
|
|
||||||
function __fish_filter_mime -d "Select files with a specific mimetype"
|
|
||||||
|
|
||||||
set -l mime_search $argv[1]
|
|
||||||
set -e argv[1]
|
|
||||||
|
|
||||||
if not set -l mime (mimedb -f $argv)
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
|
|
||||||
if count $mime > /dev/null
|
|
||||||
set -l res
|
|
||||||
for i in (seq (count $mime))
|
|
||||||
switch $mime[$i]
|
|
||||||
case $mime_search
|
|
||||||
set res $res $argv[$i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
printf "%s\n" $res
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user