Created
August 29, 2008 14:56
Tab complete the 'open' command in OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://woss.name/2005/09/06/bash-completion-for-mac-os-x-open/ | |
if [ "`uname`" = "Darwin" ]; then | |
_open() { | |
local cur prev | |
COMPREPLY=() | |
cur=${COMP_WORDS[COMP_CWORD]} | |
prev=${COMP_WORDS[COMP_CWORD-1]} | |
if [ "${prev}" = -a ]; then | |
local IFS=$'\n' | |
COMPREPLY=( $( | |
compgen -W "$( | |
/bin/ls -d1 /Applications/*/*.app /Applications/*.app | \ | |
sed 's|^.*/\([^/]*\)\.app.*|\1|;s/\ /\\ /g' | |
)" -- $cur) | |
) | |
return 0 | |
fi | |
} | |
complete -F _open -o default open | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment