Skip to content

Instantly share code, notes, and snippets.

@cabo
Created June 19, 2012 21:26
Show Gist options
  • Save cabo/2956641 to your computer and use it in GitHub Desktop.
Save cabo/2956641 to your computer and use it in GitHub Desktop.
.profile snippet for completed command line eject (via hdiutil)
function ej() {
for i
do
echo ejecting /Volumes/"$i"...
hdiutil eject /Volumes/"$i"
done
}
function _ej() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local v=$(cd /Volumes/; find -x . -type d -depth 1 | sed s/..//)
COMPREPLY=( $(compgen -W "$v" -- $cur) )
}
complete -F _ej ej
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment