2011-08-08 03:43:32 +08:00
|
|
|
#compdef adb
|
|
|
|
#autoload
|
|
|
|
|
|
|
|
# in order to make this work, you will need to have the android adb tools
|
|
|
|
|
|
|
|
# adb zsh completion, based on homebrew completion
|
|
|
|
|
|
|
|
local -a _1st_arguments
|
|
|
|
_1st_arguments=(
|
|
|
|
'bugreport:return all information from the device that should be included in a bug report.'
|
|
|
|
'connect:connect to a device via TCP/IP Port 5555 is default.'
|
|
|
|
'devices:list all connected devices'
|
|
|
|
'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
|
|
|
|
'emu:run emulator console command'
|
|
|
|
'forward:forward socket connections'
|
2017-06-08 05:47:47 +08:00
|
|
|
'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'
|
2011-08-08 03:43:32 +08:00
|
|
|
'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'
|
2017-06-08 05:47:47 +08:00
|
|
|
'keygen:generate adb public/private key'
|
2015-05-07 19:24:33 +08:00
|
|
|
'kill-server:kill the server if it is running'
|
|
|
|
'logcat:view device log'
|
2011-08-08 03:43:32 +08:00
|
|
|
'pull:copy file/dir from device'
|
|
|
|
'push:copy file/dir to device'
|
2015-05-07 19:24:33 +08:00
|
|
|
'reboot:reboots the device, optionally into the bootloader or recovery program'
|
|
|
|
'reboot-bootloader:reboots the device into the bootloader'
|
|
|
|
'remount:remounts the partitions on the device read-write'
|
|
|
|
'root:restarts the adbd daemon with root permissions'
|
|
|
|
'sideload:push a ZIP to device and install it'
|
2011-08-08 03:43:32 +08:00
|
|
|
'shell:run remote shell interactively'
|
|
|
|
'sync:copy host->device only if changed (-l means list but dont copy)'
|
2015-05-07 19:24:33 +08:00
|
|
|
'start-server:ensure that there is a server running'
|
|
|
|
'tcpip:restart host adb in tcpip mode'
|
2011-08-08 03:43:32 +08:00
|
|
|
'uninstall:remove this app package from the device'
|
2017-06-08 05:47:47 +08:00
|
|
|
'usb:restart the adbd daemon listing on USB'
|
2011-08-08 03:43:32 +08:00
|
|
|
'version:show version num'
|
2015-05-07 19:24:33 +08:00
|
|
|
'wait-for-device:block until device is online'
|
2011-08-08 03:43:32 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
local expl
|
|
|
|
local -a pkgs installed_pkgs
|
|
|
|
|
|
|
|
_arguments \
|
2017-12-05 07:08:07 +08:00
|
|
|
'-s[devices]:specify device:->specify_device' \
|
2011-08-08 03:43:32 +08:00
|
|
|
'*:: :->subcmds' && return 0
|
|
|
|
|
2017-12-05 07:08:07 +08:00
|
|
|
case "$state" in
|
|
|
|
specify_device)
|
2017-12-08 07:52:52 +08:00
|
|
|
_values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \
|
|
|
|
{printf "%s[%s] ",$1,$6 }')
|
2017-12-05 07:08:07 +08:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2011-08-08 03:43:32 +08:00
|
|
|
if (( CURRENT == 1 )); then
|
|
|
|
_describe -t commands "adb subcommand" _1st_arguments
|
|
|
|
return
|
|
|
|
fi
|
2012-01-04 00:12:22 +08:00
|
|
|
|
2017-12-05 07:08:07 +08:00
|
|
|
_files
|