1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-19 11:31:26 +01:00

49962: _adb: Add dumpsys and cmd completion

This commit is contained in:
Mikael Magnusson 2022-04-03 18:33:58 +02:00
parent 76b573fcbd
commit 8a60e2e214
2 changed files with 24 additions and 1 deletions

View file

@ -8,6 +8,9 @@
* 49961: Completion/Unix/Command/_adb: _adb: handle exec-out
like shell
* 49962: Completion/Unix/Command/_adb: _adb: Add dumpsys and
cmd completion
2022-04-02 dana <dana@dana.is>
* unposted (see 48073): Completion/Zsh/Command/_fc: Complete

View file

@ -189,6 +189,12 @@ _adb_dispatch_shell () {
(pm)
(( $+functions[_adb_package_manager_handler] )) && _adb_package_manager_handler
;;
(cmd)
(( $+functions[_adb_cmd_handler] )) && _adb_cmd_handler
;;
(dumpsys)
(( $+functions[_adb_dumpsys_handler] )) && _adb_dumpsys_handler
;;
(*)
_arguments '*: :_adb_remote_folder'
;;
@ -319,6 +325,20 @@ _adb_package_manager_handler () {
esac
}
(( $+functions[_adb_cmd_handler] )) ||
_adb_cmd_handler () {
local -a cmds
cmds=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out cmd -l)"}[2,-1]}##[[:space:]]##})
_wanted dumpsys expl 'cmd command' compadd ${cmds%$'\r'}
}
(( $+functions[_adb_dumpsys_handler] )) ||
_adb_dumpsys_handler () {
local -a services
services=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out dumpsys -l)"}[2,-1]}##[[:space:]]##})
_wanted dumpsys expl 'dumpsys service' compadd ${services%$'\r'}
}
(( $+functions[_adb_dispatch_uninstall] )) ||
_adb_dispatch_uninstall () {
_arguments \
@ -466,7 +486,7 @@ _adb_options_handler() {
(( $+functions[_adb_shell_commands_handler] )) ||
_adb_shell_commands_handler() {
local expl
_wanted adb_shell_commands expl 'adb shell command' compadd ls pm am mkdir rmdir rm cat
_wanted adb_shell_commands expl 'adb shell command' compadd ls pm am mkdir rmdir rm cat cmd dumpsys
}
(( $+functions[_adb_device_available] )) ||