zsh-workers
 help / color / mirror / code / Atom feed
* completion: adb remote folder problems due to ls columnated output
@ 2018-02-01 14:08 WGH
  0 siblings, 0 replies; only message in thread
From: WGH @ 2018-02-01 14:08 UTC (permalink / raw)
  To: zsh-workers

For some reason, `adb shell ls` command on my Android (Lineage OS 14.1,
Android 7.1.2) and adb (1.0.32) prints directory listing in several
columns, even if its stdout is connected to pipe (as opposed of terminal).

It breaks the completion script, which expects one file per line.

This patch fixes the issue for me. Assuming ls supports -1 option, It
shouldn't break setups that already output one file per line.

diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb
index 6b56d1748..f0ffdb5a4 100644
--- a/Completion/Unix/Command/_adb
+++ b/Completion/Unix/Command/_adb
@@ -480,7 +480,7 @@ _adb_remote_folder () {
     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'})
+  files=(${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'ls -1d 2>
/dev/null '$pref'*/ '$pref'*')"}%$'\r'})
   dirs=(${${(M)files:#*/}%/})
   files=(${${files:|dirs}:#*\*(/|)})
   _adb_device_available && \


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-01 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 14:08 completion: adb remote folder problems due to ls columnated output WGH

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).