File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 33_xdg_mime_mimetype ()
44{
55 local d i
6+ local -a arr
67 for d in /usr/share/mime /usr/local/share/mime; do
7- command cd $d 2> /dev/null || continue
8- trap " command cd - &>/dev/null" RETURN
9- _filedir xml
10- for i in ${! COMPREPLY[*]} ; do
11- # packages/ is not a MIME type dir
12- [[ ${COMPREPLY[i]} != packages* ]] || unset -v " COMPREPLY[i]"
8+ arr=($(
9+ command cd " $d " 2> /dev/null || exit 1
10+ compgen -f -o plusdirs -X " !*.xml" -- " $cur "
11+ ) ) || continue
12+ for i in ${! arr[*]} ; do
13+ case ${arr[i]} in
14+ packages* ) unset -v " arr[i]" ;; # not a MIME type dir
15+ * .xml) arr[i]=${arr[i]% .xml} ;;
16+ * /* ) ;;
17+ * ) arr[i]+=/ ;;
18+ esac
1319 done
14- COMPREPLY=(" ${COMPREPLY[@]% .xml} " )
15- return
20+ COMPREPLY+=(" ${arr[@]} " )
1621 done
22+ [[ $COMPREPLY != * / ]] || compopt -o nospace
1723}
1824
1925_xdg_mime ()
Original file line number Diff line number Diff line change 11import pytest
22
33
4- @pytest .mark .bashcomp (cmd = "xdg-mime" , ignore_env = r"^[+-](OLD)?PWD=" )
4+ @pytest .mark .bashcomp (cmd = "xdg-mime" )
55class TestXdgMime :
66 @pytest .mark .complete ("xdg-mime " )
77 def test_1 (self , completion ):
You can’t perform that action at this time.
0 commit comments