From 812e448ee56a671f6c82790230eafeb66c2345ca Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sun, 21 Aug 2011 21:39:19 +0200 Subject: [PATCH] #40 adb: Extract default completer for remote command to a separate function --- _adb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/_adb b/_adb index 7452419..ac0db72 100644 --- a/_adb +++ b/_adb @@ -98,9 +98,14 @@ _adb() { case "$state" in (remote-command-args) if (( $+functions[_adb_remote_command_$words[1]_args] )); then - _adb_remote_command_$words[1]_args && ret=0 + _adb_remote_command_$words[1] && ret=0 + # TODO Write handlers for following commands: + # * am (Activity Manager) + # * pm (Package Manager) + # TODO Reuse existing compdefs for standard commands (ls, id, ifconfig, kill, etc) ? + # How do we tell them to use _remote_ files/pids/users/etc ? else - _wanted remote-files expl 'remote file' _adb_remote_files && ret=0 + _adb_remote_command_default && ret=0 fi ;; esac @@ -398,4 +403,9 @@ _adb_logcat_buffers() { _describe -t log-buffers 'log buffer' buffers "$@" && ret=0 } +(( $+functions[_adb_remote_command_default] )) || +_adb_remote_command_default() { + _wanted remote-files expl 'remote file' _adb_remote_files +} + _adb "$@"