_defaults_plists() {
case $2 in
/*)
COMPREPLY=( $(compgen -f -X '!*.plist' $2 | sed 's/.plist$//') )
;;
*)
COMPREPLY=( $(compgen -f -X '!*.plist' $2 | sed 's/.plist$//' | sed "s:^:`pwd`/:") )
;;
esac
return 0
}
complete -o plusdirs -o filenames -F _defaults_plists defaults
It completes only with filenames that end in .plist, and it drops the .plist from that filename. Also, if the path is a relative path, it automatically prepends the current directory to the beginning (except it seems a bit wonky with ".." relative paths).
No comments
More Mac OS X Stuff
Fine's Home
|
|
![]() |
Send Me Email |