* no tab completion with equo
@ 2014-09-15 18:13 Clemens Schüller
2014-09-16 13:01 ` Vadim A. Misbakh-Soloviov
0 siblings, 1 reply; 7+ messages in thread
From: Clemens Schüller @ 2014-09-15 18:13 UTC (permalink / raw)
To: zsh users
Hello!
equo is the frontend to the package manager of sabayon linux:
In the equo package is a tab completion file for the zsh. But zsh won't
work with the completion.
--8<---------------cut here---------------start------------->8---
[mente@cougar: ~]% equo [TAB]
No matches for: `command' or `equo command'
--8<---------------cut here---------------end--------------->8---
--8<---------------cut here---------------start------------->8---
[mente@cougar: ~]% dir /usr/share/zsh/site-functions/_equo
-rw-r--r-- 1 root root 2636 29. Jun 16:35 /usr/share/zsh/site-functions/_equo
--8<---------------cut here---------------start------------->8---
--8<---------------cut here---------------start------------->8---
[mente@cougar: ~]% cat /usr/share/zsh/site-functions/_equo
#compdef equo
local curcontext="$curcontext" state line cmds packages mirrors
typeset -A opt_args
_equo_get_mirrors()
{
mirrors=( ${(f)"$(equo status | grep Repository\ name | cut -d: -f2 | sed 's/^\ *//')"} )
_describe -t packages 'mirrors' mirrors
}
_equo_get_cmds()
{
cmds=( ${(f)"$(equo $1 --help | tr "\t" ":" | grep "^:[^:]" | sed 's/^:\([^:\ ]*\)[^:]*:*/\1:/')"} )
_describe -t commands 'command params' cmds
}
_equo_get_installed_packages()
{
packages=( ${(f)"$(equo query list installed | equo query list installed | sed 's/.*\///')"} )
_describe -t packages 'installed packages' packages
}
_equo_get_available_packages()
{
packages=( ${(f)"$(equo search $1 | grep Package |sed 's/.*\/\([^\ ]*\).*/\1/')"} )
_describe -t packages 'available packages' packages
}
_arguments -C \
"--help[print help]" \
"--version[print version]" \
"--nocolor[dont use colors]" \
"--color[use colors(default)]" \
"--bashcomp[print bash completion script]"\
'1:command:->cmds' \
'*:subcommand:->args'
case $state in
cmds)
cmds=( ${(f)"$(equo --help |tr "\t" ":" | grep "^:[^:-]" | sed 's/^:\(\w*\).*:\+/\1:/')"} )
_describe -t commands 'equo command' cmds
;;
args)
case $line[1] in
remove|config)
_equo_get_cmds $line[1] && return 0
_equo_get_installed_packages
;;
install|fetch|search|source|mask|unmask)
_equo_get_cmds $line[1] && return 0
_equo_get_available_packages $line[-1]
;;
repo)
case $line[2] in
enable|disable|remove|mirrorsort)
_equo_get_mirrors
;;
add|merge)
;;
*)
_equo_get_cmds $line[1]
;;
esac
;;
query)
case $line[2] in
changelog|revdeps|files|needed|removal|graph|revgraph)
_equo_get_installed_packages
;;
list)
case $line[3] in
available)
_equo_get_mirrors
;;
installed)
;;
*)
cmds=( ${(f)"$(equo query list --help |tr "\t" ":" | grep "^::[^:]" | sed 's/^::\([^:\ ]*\)[^:]*:*/\1:/')"} )
_describe -t commands 'command params' cmds
;;
esac
;;
belongs|description|license|mimetype|asociate|orphans|required|sets|slots|tags)
;;
*)
_equo_get_cmds $line[1]
;;
esac
;;
notice)
_equo_get_mirrors
;;
cleanup|status)
;;
*)
_equo_get_cmds $line[1]
;;
esac
;;
esac
--8<---------------cut here---------------start------------->8---
Can anyone help me. Thanks :-)
--
Best Regards, Clemens Schüller
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: no tab completion with equo
2014-09-15 18:13 no tab completion with equo Clemens Schüller
@ 2014-09-16 13:01 ` Vadim A. Misbakh-Soloviov
2014-09-16 16:22 ` Clemens Schüller
0 siblings, 1 reply; 7+ messages in thread
From: Vadim A. Misbakh-Soloviov @ 2014-09-16 13:01 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 772 bytes --]
В письме от Пн, 15 сентября 2014 20:13:38 пользователь Clemens Schüller
написал:
> Hello!
>
>
> equo is the frontend to the package manager of sabayon linux:
>
> In the equo package is a tab completion file for the zsh. But zsh won't
> work with the completion.
>
Hi!
First of all, it is orphaned (nobody fixed it for new equo/entropy API).
I thought to do it some time ago, but I've no enough time for it.
But I can hint, that basic completion is broken here:
> case $state in
> cmds)
> cmds=( ${(f)"$(equo --help |tr "\t" ":" | grep "^:[^:-]" | sed
> 's/^:\(\w*\).*:\+/\1:/')"} ) _describe -t commands 'equo command' cmds
(there is no \t's anymore in equo output) ;)
--
Best regards,
mva
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: no tab completion with equo
2014-09-16 13:01 ` Vadim A. Misbakh-Soloviov
@ 2014-09-16 16:22 ` Clemens Schüller
2014-09-17 0:28 ` Bart Schaefer
2014-09-17 6:27 ` Vadim A. Misbakh-Soloviov
0 siblings, 2 replies; 7+ messages in thread
From: Clemens Schüller @ 2014-09-16 16:22 UTC (permalink / raw)
To: zsh users
Hello, Vadim!
First of all: Thanks for your reply :-)
"Vadim A. Misbakh-Soloviov" <mva@mva.name> writes:
> В письме от Пн, 15 сентября 2014 20:13:38 пользователь Clemens Schüller
> написал:
>> case $state in
>> cmds)
>> cmds=( ${(f)"$(equo --help |tr "\t" ":" | grep "^:[^:-]" | sed
>> 's/^:\(\w*\).*:\+/\1:/')"} ) _describe -t commands 'equo command' cmds
>
> (there is no \t's anymore in equo output) ;)
When I completely cut out the tr part from the pipe, the error is the same.
Do you mean this or something else?
--
Best Regards, Clemens Schüller
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: no tab completion with equo
2014-09-16 16:22 ` Clemens Schüller
@ 2014-09-17 0:28 ` Bart Schaefer
2014-10-09 2:40 ` Clemens Schüller
2014-09-17 6:27 ` Vadim A. Misbakh-Soloviov
1 sibling, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2014-09-17 0:28 UTC (permalink / raw)
To: Clemens Schuller, zsh users
On Sep 16, 6:22pm, Clemens Schuller wrote:
}
} >> cmds=( ${(f)"$(equo --help |tr "\t" ":" | grep "^:[^:-]" | sed
} >> 's/^:\(\w*\).*:\+/\1:/')"} ) _describe -t commands 'equo command' cmds
} >
} > (there is no \t's anymore in equo output) ;)
}
} When I completely cut out the tr part from the pipe, the error is the same.
}
} Do you mean this or something else?
I think you need to run "equo --help" and look at it. Removing the "tr"
just fails to convert anything into colons, so the grep|sed that follows
won't properly slice up the listing into the individual sub-commands.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: no tab completion with equo
2014-09-16 16:22 ` Clemens Schüller
2014-09-17 0:28 ` Bart Schaefer
@ 2014-09-17 6:27 ` Vadim A. Misbakh-Soloviov
2014-10-09 2:43 ` Clemens Schüller
1 sibling, 1 reply; 7+ messages in thread
From: Vadim A. Misbakh-Soloviov @ 2014-09-17 6:27 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]
(sorry, previous try was sent to you personally, but not to the list)
(it's strange, that client hassuch reaction on your letters to the list).
(anyway, resentit to the list)
> When I completely cut out the tr part from the pipe, the error is the same.
>
> Do you mean this or something else?
No. I not mean you should remove tr. I mean, you should start to dig here (and
replace that command with properone to get equo command list.
For example,
> equo --bashcomp
Although, it'll be best to minimize equo calls on completion generation (since
it is both slower and dangerous (nobody guarantee, that Fabio will not change
syntax again tomorrow ;)
Although, I guess, it is pretty ok to use
> --bashcomp
for first level completion.
Also, as far as I looked in the equo and Entropy code, --bashcomp should not
have it's current behaviour of returning first-level arguments all the time,
but should return proper arguments for each level. Unfortunately, it is
broken, and probably, you (and me, lol) should poke Fabio (lxnay) about that
on sabayon BZ or #sabayon-dev @ FreeNode.
Alternativelly, it is possible to just make completion with manually
predefined arguments list (like I did for emerge in gentoo's zsh-completion
package) and call equo only when it is really needed (packages completion and
so on).
Anyway, it needs a bit more work, than just fix tr :)
--
Best regards,
mva
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: no tab completion with equo
2014-09-17 0:28 ` Bart Schaefer
@ 2014-10-09 2:40 ` Clemens Schüller
0 siblings, 0 replies; 7+ messages in thread
From: Clemens Schüller @ 2014-10-09 2:40 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh users
Hello!
Bart Schaefer <schaefer@brasslantern.com> writes:
> On Sep 16, 6:22pm, Clemens Schuller wrote:
> }
> } >> cmds=( ${(f)"$(equo --help |tr "\t" ":" | grep "^:[^:-]" | sed
> } >> 's/^:\(\w*\).*:\+/\1:/')"} ) _describe -t commands 'equo command' cmds
> } >
> } > (there is no \t's anymore in equo output) ;)
> }
> } When I completely cut out the tr part from the pipe, the error is the same.
> }
> } Do you mean this or something else?
>
> I think you need to run "equo --help" and look at it. Removing the "tr"
> just fails to convert anything into colons, so the grep|sed that follows
> won't properly slice up the listing into the individual sub-commands.
Sorry, but I am not familiar with shell coding.
I will wait, until the changes are applied in the _equo file ;-)
--
Best Regards, Clemens Schüller
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: no tab completion with equo
2014-09-17 6:27 ` Vadim A. Misbakh-Soloviov
@ 2014-10-09 2:43 ` Clemens Schüller
0 siblings, 0 replies; 7+ messages in thread
From: Clemens Schüller @ 2014-10-09 2:43 UTC (permalink / raw)
To: Vadim A. Misbakh-Soloviov; +Cc: zsh-users
Hello!
"Vadim A. Misbakh-Soloviov" <mva@mva.name> writes:
> (sorry, previous try was sent to you personally, but not to the list)
> (it's strange, that client hassuch reaction on your letters to the list).
> (anyway, resentit to the list)
No problem ;-)
[ ... ]
> Also, as far as I looked in the equo and Entropy code, --bashcomp should not
> have it's current behaviour of returning first-level arguments all the time,
> but should return proper arguments for each level. Unfortunately, it is
> broken, and probably, you (and me, lol) should poke Fabio (lxnay) about that
> on sabayon BZ or #sabayon-dev @ FreeNode.
>
> Alternativelly, it is possible to just make completion with manually
> predefined arguments list (like I did for emerge in gentoo's zsh-completion
> package) and call equo only when it is really needed (packages completion and
> so on).
>
> Anyway, it needs a bit more work, than just fix tr :)
As I wrote in the other mail (reply to Barts Posting): I am not familiar
with shell coding. I will wait, until you have the time to fix the
error(s) in the _equo file.
TIA
--
Best Regards, Clemens Schüller
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-09 2:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15 18:13 no tab completion with equo Clemens Schüller
2014-09-16 13:01 ` Vadim A. Misbakh-Soloviov
2014-09-16 16:22 ` Clemens Schüller
2014-09-17 0:28 ` Bart Schaefer
2014-10-09 2:40 ` Clemens Schüller
2014-09-17 6:27 ` Vadim A. Misbakh-Soloviov
2014-10-09 2:43 ` Clemens Schüller
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).