diff options
Diffstat (limited to 'plugins/adb')
-rw-r--r-- | plugins/adb/README.md | 2 | ||||
-rw-r--r-- | plugins/adb/_adb | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/plugins/adb/README.md b/plugins/adb/README.md index 075beec0e..83dcc7288 100644 --- a/plugins/adb/README.md +++ b/plugins/adb/README.md @@ -1,7 +1,7 @@ # adb autocomplete plugin * Adds autocomplete options for all adb commands. - +* Add autocomplete for `adb -s` ## Requirements diff --git a/plugins/adb/_adb b/plugins/adb/_adb index f30f3247f..78c457746 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -13,9 +13,13 @@ _1st_arguments=( 'disconnect:disconnect from a TCP/IP device. Port 5555 is default.' 'emu:run emulator console command' 'forward:forward socket connections' +'get-devpath:print the device path' +'get-serialno:print the serial number of the device' +'get-state:print the current state of the device: offline | bootloader | device' 'help:show the help message' 'install:push this package file to the device and install it' 'jdwp:list PIDs of processes hosting a JDWP transport' +'keygen:generate adb public/private key' 'kill-server:kill the server if it is running' 'logcat:view device log' 'pull:copy file/dir from device' @@ -30,6 +34,7 @@ _1st_arguments=( 'start-server:ensure that there is a server running' 'tcpip:restart host adb in tcpip mode' 'uninstall:remove this app package from the device' +'usb:restart the adbd daemon listing on USB' 'version:show version num' 'wait-for-device:block until device is online' ) @@ -38,8 +43,22 @@ local expl local -a pkgs installed_pkgs _arguments \ + '-s[devices]:specify device:->specify_device' \ '*:: :->subcmds' && return 0 +case "$state" in + specify_device) + _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \ + {sub(/ +/," ",$0); \ + gsub(":","\\:",$1); \ + for(i=1;i<=NF;i++) { + if($i ~ /model:/) { split($i,m,":") } \ + else if($i ~ /product:/) { split($i,p,":") } } \ + printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""} + return + ;; +esac + if (( CURRENT == 1 )); then _describe -t commands "adb subcommand" _1st_arguments return |