zsh-workers
 help / color / mirror / code / Atom feed
* adb pull and push remote completion
@ 2017-01-25  9:41 Dov Grobgeld
       [not found] ` <CA+mcLN77BVXV26R+NavQfDX8yCjV1CGjzKQx7LZd-E9ZYSE5rw@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Dov Grobgeld @ 2017-01-25  9:41 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

Hello,

Here's a feature request, that may or may not be supposed by the current
adb function.

In the pull or push command do remote completion of the files on the
device. The following zsh commands provides almost the functionality,
(except for "leaving" the current argument, instead of staying at it for
further completion):

function -K adblist {
  read -l cmdline;
  args=("${(@s/ /)cmdline}")

  if [[ ( $args[2] == "pull" && $#args -eq 3 )
        || ( $args[2] == "push" && $#args -eq 4) ]]; then
    reply=(`adb shell ls -a1d $1\* 2&>/dev/null`)
  else
    reply=(`ls -a1d $1*`)
  fi
}
compctl -K adblist adb

Regards,
Dov

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Fwd: adb pull and push remote completion
       [not found] ` <CA+mcLN77BVXV26R+NavQfDX8yCjV1CGjzKQx7LZd-E9ZYSE5rw@mail.gmail.com>
@ 2017-02-21 13:20   ` Julien Nicoulaud
  2017-02-21 17:23     ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Nicoulaud @ 2017-02-21 13:20 UTC (permalink / raw)
  To: Mailing-list zsh-workers; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1173 bytes --]

Hi Dov,

A while ago there was a compdef for adb in https://github.com/zsh-
users/zsh-completions, but we deleted it as there was one in zsh:
https://github.com/zsh-users/zsh-completions/blob/
e70e7f8941d7437a161e3e4bb93f06e9c712c4a4/src/_adb

I'm not sure which one is the better one, they probably need merging, but
anyway the one in zsh-completions could complete adb push/pull.
I hope this can be useful.

Cheers,
Julien

2017-01-25 10:41 GMT+01:00 Dov Grobgeld <dov.grobgeld@gmail.com>:

> Hello,
>
> Here's a feature request, that may or may not be supposed by the current
> adb function.
>
> In the pull or push command do remote completion of the files on the
> device. The following zsh commands provides almost the functionality,
> (except for "leaving" the current argument, instead of staying at it for
> further completion):
>
> function -K adblist {
>   read -l cmdline;
>   args=("${(@s/ /)cmdline}")
>
>   if [[ ( $args[2] == "pull" && $#args -eq 3 )
>         || ( $args[2] == "push" && $#args -eq 4) ]]; then
>     reply=(`adb shell ls -a1d $1\* 2&>/dev/null`)
>   else
>     reply=(`ls -a1d $1*`)
>   fi
> }
> compctl -K adblist adb
>
> Regards,
> Dov
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: adb pull and push remote completion
  2017-02-21 13:20   ` Fwd: " Julien Nicoulaud
@ 2017-02-21 17:23     ` Oliver Kiddle
  2017-02-21 17:32       ` Julien Nicoulaud
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2017-02-21 17:23 UTC (permalink / raw)
  To: Julien Nicoulaud; +Cc: Mailing-list zsh-workers

Julien Nicoulaud wrote:
>
> A while ago there was a compdef for adb in https://github.com/zsh-
> users/zsh-completions, but we deleted it as there was one in zsh:
> https://github.com/zsh-users/zsh-completions/blob/
> e70e7f8941d7437a161e3e4bb93f06e9c712c4a4/src/_adb
>
> I'm not sure which one is the better one, they probably need merging, but
> anyway the one in zsh-completions could complete adb push/pull.
> I hope this can be useful.

A cursory glance at the adb completion in zsh would indicate that, while
there is plenty of scope for improvement, it is at least attempting to
complete files on the remote device for push/pull. Without the requisite
hardware, I can't test it and last time I touched that function I managed
to accidentally break it so I'm reluctant to change it. Does it not work
for you?

More generally, whether or not the function in zsh is better or worse,
it is the one that was contributed to zsh. Personally I'm wary of ever
picking up functions from github projects and merging their features,
especially where they have an explicit licence other than the zsh
licence. In this case it appears that you are the author of the old
function on github so you'd not have to worry. It might be possible to
use the _remote_files helper when completing the files.

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: adb pull and push remote completion
  2017-02-21 17:23     ` Oliver Kiddle
@ 2017-02-21 17:32       ` Julien Nicoulaud
  0 siblings, 0 replies; 4+ messages in thread
From: Julien Nicoulaud @ 2017-02-21 17:32 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: Mailing-list zsh-workers, zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1645 bytes --]

Hi Oliver,

2017-02-21 18:23 GMT+01:00 Oliver Kiddle <okiddle@yahoo.co.uk>:

> Julien Nicoulaud wrote:
> >
> > A while ago there was a compdef for adb in https://github.com/zsh-
> > users/zsh-completions, but we deleted it as there was one in zsh:
> > https://github.com/zsh-users/zsh-completions/blob/
> > e70e7f8941d7437a161e3e4bb93f06e9c712c4a4/src/_adb
> >
> > I'm not sure which one is the better one, they probably need merging, but
> > anyway the one in zsh-completions could complete adb push/pull.
> > I hope this can be useful.
>
> A cursory glance at the adb completion in zsh would indicate that, while
> there is plenty of scope for improvement, it is at least attempting to
> complete files on the remote device for push/pull. Without the requisite
> hardware, I can't test it and last time I touched that function I managed
> to accidentally break it so I'm reluctant to change it. Does it not work
> for you?
>
I can't test either, I don't have an Android device anymore.

>
> More generally, whether or not the function in zsh is better or worse,
> it is the one that was contributed to zsh. Personally I'm wary of ever
> picking up functions from github projects and merging their features,
> especially where they have an explicit licence other than the zsh
> licence. In this case it appears that you are the author of the old
> function on github so you'd not have to worry. It might be possible to
> use the _remote_files helper when completing the files.
>
Agreed, I just wanted to give a pointer in case it can be useful.
If anyone wants to work on merging the compdefs the license is not a
problem.

>
> Oliver
>
Julien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-21 17:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25  9:41 adb pull and push remote completion Dov Grobgeld
     [not found] ` <CA+mcLN77BVXV26R+NavQfDX8yCjV1CGjzKQx7LZd-E9ZYSE5rw@mail.gmail.com>
2017-02-21 13:20   ` Fwd: " Julien Nicoulaud
2017-02-21 17:23     ` Oliver Kiddle
2017-02-21 17:32       ` Julien Nicoulaud

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).