From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Henryk Konsek <hak8@wp.pl>
Cc: zsh-workers@sunsite.dk
Subject: Re: _unace
Date: Thu, 03 Mar 2005 14:36:23 +0100 [thread overview]
Message-ID: <32033.1109856983@trentino.groupinfra.com> (raw)
In-Reply-To: <200503022019.52992.hak8@wp.pl>
[-- Attachment #1: Type: text/plain, Size: 2269 bytes --]
Henryk Konsek wrote:
> I've written completion file for the unace command. Its syntax is very
Thanks for this.
> similar to the unrar command so I've used part of _rar as a pattern while
> creating it. This is my first completion file so I would be grateful for any
> comments.
I'll put a few comments below.
> if (( CURRENT == 2)); then
You can actually do this from _arguments directly which has the
advantage that it will then complete unace commands after any switches.
You do this by starting an _arguments specification with a number. For
example:
'1:unace command:((e\:extract\ files l\:list\ archive))'
The final component of that lets you specify what to complete. The
syntax above with the descriptions is similar in effect to your use of
_values.
> '-c\ [Show comments]' \
What is the `\ ' in there for?
> '-p\<password>[Set <password>]' \
If a password is defined after the -p switch, you can use this:
'-p[specify password]:password' \
It then knows to prompt for a password to be completed after -p. If the
password should be imediately after the `-p' (as with unace) then use a
`+':
'-p+[specify password]:password' \
> '*:files:_files -g \*.rar\(-.\)\' \
Don't you mean to complete .ace files instead of .rar?
Also, looking at the output of unace -h, there is also a -x option for
excluding files. It also looks like it should actually complete archive
(.ace) files in the second argument position only and then complete
files from within the archive. _zip does something similar if you want
to have a look.
Also from the unace -h output, it looks like the options need a trailing
`-' or `+' to indicate enabled or disabled. It says:
<Switches> (default)
c[-] Show comments (+)
f[-] Full path matching (-)
o[-] Overwrite files (-)
Can the defaults be changed? If not, we could just use something like:
'-c\-[show comments]' \
'-f\+[full path matching]' \
If the defaults are configurable, we may need:
'-c+[show comments]:enable:(- +)' \
Or have I misunderstood the output of unace -h?
I've attached an updated version of _unace. I've not actually got any
.ace files to test it on so you can still improve it in some of the ways
I've mentioned.
Oliver
[-- Attachment #2: _unace --]
[-- Type: text/plain, Size: 472 bytes --]
#compdef unace
_arguments -S \
'-c[show comments]' \
'-f[full path matching]' \
'-o[overwrite files]' \
'-p+[specify password]:password' \
'-y[assume yes on all queries]' \
'-x+[specify files to exclude]:files' \
'-h[print help information]' \
'1:unace command:((
e\:extract\ files
l\:list\ archive
t\:test\ archive\ integrity
v\:list\ archive\ \(verbose\)
x\:extract\ files\ with\ full\ path
))' \
'*:files:_files -g "*.ace(-.)"'
next prev parent reply other threads:[~2005-03-03 13:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-02 19:19 _unace Henryk Konsek
2005-03-03 13:36 ` Oliver Kiddle [this message]
2005-03-03 14:16 ` _unace Henryk Konsek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=32033.1109856983@trentino.groupinfra.com \
--to=okiddle@yahoo.co.uk \
--cc=hak8@wp.pl \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).