diff options
author | Mikael Magnusson <mikachu@gmail.com> | 2016-03-19 17:28:17 +0100 |
---|---|---|
committer | Mikael Magnusson <mikachu@gmail.com> | 2016-03-19 19:08:11 +0100 |
commit | ee2f0dbed113742cd9f6f5574ab2e2d280a0de34 (patch) | |
tree | 5625fddae63604db6257ab451459aa323553c74c /Completion/Unix | |
parent | 7ad041c9e9c2099c4b9ba0fa4c1b64645c1e6f37 (diff) | |
download | zsh-ee2f0dbed113742cd9f6f5574ab2e2d280a0de34.tar.gz zsh-ee2f0dbed113742cd9f6f5574ab2e2d280a0de34.tar.xz zsh-ee2f0dbed113742cd9f6f5574ab2e2d280a0de34.zip |
38187: _adb: Just check current dir instead of recursively
Thanks to LambdaComplex in IRC for help with troubleshooting.
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Command/_adb | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index c0a2bb27e..879e26045 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -470,40 +470,26 @@ _adb_device_available() { return 1 } -(( $+functions[_adb_full_folder_scan] )) || -_adb_full_folder_scan() { - filesystem_content=( ${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'cd /;for i in * - do - case $i in - proc|sys|acct) - ;; - *) - find $i 2> /dev/null - ;; - esac - done' )"}%$'\r'} ) -} - (( $+functions[_adb_remote_folder] )) || _adb_remote_folder () { - local expl - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_daily - fi - local cacheid=folder_cache_${$(adb ${=ADB_DEVICE_SPECIFICATION} get-serialno)} - typeset -a filesystem_content - if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid" - then - _adb_full_folder_scan - _store_cache "$cacheid" filesystem_content + typeset -a files dirs + local pref=${PREFIX} + if [[ $pref != */* ]]; then + pref= + elif [[ $pref != */ ]]; then + pref=${pref%/*}/ fi + # yes, this ls is sickening to look at, but android doesn't have printf or find + files=(${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'ls -d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'}) + dirs=(${${(M)files:#*/}%/}) + files=(${${files:|dirs}:#*\*(/|)}) _adb_device_available && \ - _wanted adb_remote_folder expl 'file/folder on device' _multi_parts $@ -i / filesystem_content + _wanted adb_remote_folder expl 'file/folder on device' _multi_parts $@ / files } (( $+functions[_adb_installed_packages] )) || _adb_installed_packages() { + local update_policy zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z "$update_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy _adb_cache_policy_single_command |