Created
October 16, 2009 07:00
-
-
Save romannurik/211627 to your computer and use it in GitHub Desktop.
This file contains 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
# | |
# | |
# | |
# MOVED TO http://code.google.com/p/romannurik-code/source/browse/misc/bash_completion/adb | |
# | |
# | |
# | |
function _adb() | |
{ | |
local first=${COMP_WORDS[0]} | |
local word=${COMP_WORDS[COMP_CWORD]} | |
local prev=${COMP_WORDS[COMP_CWORD-1]} | |
local cancelcomp='' | |
# See if we are looking for a device serial number | |
if [[ ${prev} == '-s' ]]; then | |
local devices=$(${first} devices | sed '1d' | cut -f 1 -d " ") | |
COMPREPLY=($(compgen -W "${devices}" -- "${word}")) | |
if [[ ${COMPREPLY} == '' ]]; then | |
COMPREPLY="" | |
echo | |
echo 'No devices found. Run "adb devices" for a sanity check.' | |
cancelcomp=1 | |
fi | |
fi | |
if [[ ${COMPREPLY} == '' && ${cancelcomp} != 1 ]]; then | |
COMPREPLY=($(compgen -f -- "${word}")) | |
fi | |
} | |
complete -F _adb adb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
additional adb helpers https://gist.github.com/schwiz/5178367