_adb 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #compdef adb
  2. #autoload
  3. # in order to make this work, you will need to have the android adb tools
  4. # adb zsh completion, based on homebrew completion
  5. local -a _1st_arguments
  6. _1st_arguments=(
  7. 'bugreport:return all information from the device that should be included in a bug report.'
  8. 'connect:connect to a device via TCP/IP Port 5555 is default.'
  9. 'devices:list all connected devices'
  10. 'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
  11. 'emu:run emulator console command'
  12. 'forward:forward socket connections'
  13. 'get-devpath:print the device path'
  14. 'get-serialno:print the serial number of the device'
  15. 'get-state:print the current state of the device: offline | bootloader | device'
  16. 'help:show the help message'
  17. 'install:push this package file to the device and install it'
  18. 'jdwp:list PIDs of processes hosting a JDWP transport'
  19. 'keygen:generate adb public/private key'
  20. 'kill-server:kill the server if it is running'
  21. 'logcat:view device log'
  22. 'pull:copy file/dir from device'
  23. 'push:copy file/dir to device'
  24. 'reboot:reboots the device, optionally into the bootloader or recovery program'
  25. 'reboot-bootloader:reboots the device into the bootloader'
  26. 'remount:remounts the partitions on the device read-write'
  27. 'root:restarts the adbd daemon with root permissions'
  28. 'sideload:push a ZIP to device and install it'
  29. 'shell:run remote shell interactively'
  30. 'sync:copy host->device only if changed (-l means list but dont copy)'
  31. 'start-server:ensure that there is a server running'
  32. 'tcpip:restart host adb in tcpip mode'
  33. 'uninstall:remove this app package from the device'
  34. 'usb:restart the adbd daemon listing on USB'
  35. 'version:show version num'
  36. 'wait-for-device:block until device is online'
  37. )
  38. local expl
  39. local -a pkgs installed_pkgs
  40. _arguments \
  41. '-s[devices]:specify device:->specify_device' \
  42. '*:: :->subcmds' && return 0
  43. case "$state" in
  44. specify_device)
  45. _values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \
  46. {printf "%s[%s] ",$1,$6 }')
  47. return
  48. ;;
  49. esac
  50. if (( CURRENT == 1 )); then
  51. _describe -t commands "adb subcommand" _1st_arguments
  52. return
  53. fi
  54. _files