From 1c958e02a5613a4312534b1afe9f9f8c4a0793c2 Mon Sep 17 00:00:00 2001 From: Tobias Preuss Date: Wed, 7 Jun 2017 23:47:47 +0200 Subject: Extend list of adb commands. (#5584) --- plugins/adb/_adb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/adb') diff --git a/plugins/adb/_adb b/plugins/adb/_adb index f30f3247f..5f37bedac 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' ) -- cgit v1.2.3-70-g09d2 From 2af2d1aa31caa534c419e72d75daa667ff725de2 Mon Sep 17 00:00:00 2001 From: kg Date: Tue, 5 Dec 2017 07:08:07 +0800 Subject: add autocomplete for adb -s option (#6121) --- plugins/adb/README.md | 2 +- plugins/adb/_adb | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'plugins/adb') 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 5f37bedac..2e3c3658e 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -43,11 +43,20 @@ local expl local -a pkgs installed_pkgs _arguments \ + '-s[devices]:specify device:->specify_device' \ '*:: :->subcmds' && return 0 +case "$state" in + specify_device) + _values 'devices' $(adb devices|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ + {printf "%s[Device_%d:%s] ",$1,++i,$2 }') + return + ;; +esac + if (( CURRENT == 1 )); then _describe -t commands "adb subcommand" _1st_arguments return fi -_files +_files \ No newline at end of file -- cgit v1.2.3-70-g09d2 From e999f104e74039b291070af435a494a88eb7d704 Mon Sep 17 00:00:00 2001 From: kg Date: Fri, 8 Dec 2017 07:52:52 +0800 Subject: Update adb (#6472) --- plugins/adb/_adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/adb') diff --git a/plugins/adb/_adb b/plugins/adb/_adb index 2e3c3658e..8cbf6593c 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -48,8 +48,8 @@ _arguments \ case "$state" in specify_device) - _values 'devices' $(adb devices|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ - {printf "%s[Device_%d:%s] ",$1,++i,$2 }') + _values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ + {printf "%s[%s] ",$1,$6 }') return ;; esac -- cgit v1.2.3-70-g09d2 From c99844d84891076dceb5638bd6f4ad1599358cea Mon Sep 17 00:00:00 2001 From: kang Date: Sun, 17 Jun 2018 06:07:03 +0800 Subject: adb: fix `adb -s` device completion (#6489) --- plugins/adb/_adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/adb') diff --git a/plugins/adb/_adb b/plugins/adb/_adb index 8cbf6593c..e3c20d751 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -48,8 +48,8 @@ _arguments \ case "$state" in specify_device) - _values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ - {printf "%s[%s] ",$1,$6 }') + _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \ + {sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""} return ;; esac -- cgit v1.2.3-70-g09d2 From dfd1b4f8dfe977016bfe0ecd0fc360a526252827 Mon Sep 17 00:00:00 2001 From: Muhannad Fakhouri Date: Sun, 17 Feb 2019 23:10:17 +0100 Subject: adb: improve `adb -s` completion to show helpful info (#7532) Currently it shows for example the following: DEVICE_ID -- transport_id:2 which doesn't really ease device selection. I've adapted the awk script to print device name with it's model name, see the example below: DEVICE_ID -- Pixel_3(blueline) --- plugins/adb/_adb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins/adb') diff --git a/plugins/adb/_adb b/plugins/adb/_adb index e3c20d751..78c457746 100644 --- a/plugins/adb/_adb +++ b/plugins/adb/_adb @@ -49,7 +49,12 @@ _arguments \ case "$state" in specify_device) _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \ - {sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""} + {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 @@ -59,4 +64,4 @@ if (( CURRENT == 1 )); then return fi -_files \ No newline at end of file +_files -- cgit v1.2.3-70-g09d2