summaryrefslogtreecommitdiff
path: root/plugins/adb
diff options
context:
space:
mode:
authorMuhannad Fakhouri <mohand1993@hotmail.com>2019-02-17 23:10:17 +0100
committerMarc Cornellà <marc.cornella@live.com>2019-02-17 23:10:17 +0100
commitdfd1b4f8dfe977016bfe0ecd0fc360a526252827 (patch)
tree93184cd84fc630e5d46fa21076c1d69906ce5199 /plugins/adb
parent424b24761bcb639ee105535d927ff8205f6d2412 (diff)
downloadzsh-dfd1b4f8dfe977016bfe0ecd0fc360a526252827.tar.gz
zsh-dfd1b4f8dfe977016bfe0ecd0fc360a526252827.tar.bz2
zsh-dfd1b4f8dfe977016bfe0ecd0fc360a526252827.zip
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)
Diffstat (limited to 'plugins/adb')
-rw-r--r--plugins/adb/_adb9
1 files changed, 7 insertions, 2 deletions
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