aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2015-10-15 11:50:30 -0700
committerMakoto Onuki <omakoto@google.com>2015-10-15 11:50:30 -0700
commitfde97583114f091c19f6e9b32fd3cd0f753390ef (patch)
tree06844a697aad3d4c9bf8ec83bbf054d4bfa92dba
parente8826f6285217ccf821563f4bf3546c7d230e1c4 (diff)
downloadplatform_sdk-fde97583114f091c19f6e9b32fd3cd0f753390ef.tar.gz
platform_sdk-fde97583114f091c19f6e9b32fd3cd0f753390ef.tar.bz2
platform_sdk-fde97583114f091c19f6e9b32fd3cd0f753390ef.zip
Bash completion: Fix ls options and also support "shell cat"
Change-Id: I93d767f17fec35bc386ee8da42ea4831d4df1553
-rw-r--r--bash_completion/adb.bash14
1 files changed, 9 insertions, 5 deletions
diff --git a/bash_completion/adb.bash b/bash_completion/adb.bash
index f5c710579..4b10e14fc 100644
--- a/bash_completion/adb.bash
+++ b/bash_completion/adb.bash
@@ -208,7 +208,10 @@ _adb_cmd_shell() {
i=$((i+1))
case "$cur" in
ls)
- _adb_shell_ls $serial $i
+ _adb_shell_file_command $serial $i "--color -A -C -F -H -L -R -S -Z -a -c -d -f -h -i -k -l -m -n -p -q -r -s -t -u -x -1"
+ ;;
+ cat)
+ _adb_shell_file_command $serial $i "-h -e -t -u -v"
;;
dumpsys)
_adb_cmd_shell_dumpsys "$serial" $i
@@ -345,8 +348,8 @@ _adb_cmd_uninstall() {
COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "${packages}" -- "${cur}") )
}
-_adb_shell_ls() {
- local serial i cur file
+_adb_shell_file_command() {
+ local serial i cur file options
local -a args
serial=$1
@@ -354,6 +357,7 @@ _adb_shell_ls() {
if [ "$serial" != "none" ]; then
args=(-s $serial)
fi
+ options=$3
where=OPTIONS
for ((; i <= COMP_CWORD; i++)); do
@@ -376,8 +380,8 @@ _adb_shell_ls() {
case $where in
OPTIONS)
- COMPREPLY=( $(compgen -W "$OPTIONS" -- "$cur") )
- _adb_util_list_files $serial "$file"
+ unset IFS
+ COMPREPLY=( $(compgen -W "$options" -- "$cur") )
;;
FILE)
_adb_util_list_files $serial "$file"