From: Felix Rosencrantz <f_rosencrantz@yahoo.com>
To: zsh-workers <zsh-workers@sunsite.auc.dk>, beppu@ax9.org
Subject: Re: A Completion Function for FIGlet
Date: Sun, 24 Mar 2002 13:15:16 -0800 (PST) [thread overview]
Message-ID: <20020324211516.73312.qmail@web10406.mail.yahoo.com> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 4088 bytes --]
Just a shameless plug for my xml to completion tools....
The figlet command doesn't have usage information in a format that is
usable by my tool. There is simple usage information and there is a man
page. Though if you created a GNU style usage/help screen like so (this
is based on the previously posted completion function and the man page).
-c center justify
-k use kerning
-l left justify
-n normal mode
-o let letters overlap
-p paragraph mode
-r right justify
-s smushed spacing
-t use terminal width
-v version
-x use default justification of font
-D use Deutsch character set
-E use English character set
-L left-to-right
-N clear controlfile list
-R right-to-left
-S smush letters together or else!
-W wide spacing
-X use default writing direction of font
-w Width output width (in columns)
-d dir Font Directory
-f change_font Font
-C change_controlfile Control file
-I -1 Normal operation (default)
-I -v Version, copyright and usage information
-I 0 Version, copyright and usage information
-I 1 Version in integer format
-I 2 Default font directory.
-I 3 Name of font figlet would use
-I 4 Output width in number columns.
And then giving a help2simple.pl command like so:
help2simple.pl -c figlet -S -a message \
-x -c,-l,-r,-x \
-x -t,-w -x -n,-p \
-x -D,-E -x -N,-C \
-x -S,-s,-k,-W,-o \
-x -L,-R,-X \
-x -v,-I < Figlet.help >! figlet_simple.xml
The -S says that all single dash flags are single letters. The -x flag
says that the following comma separated list of flags are mutually exclusive.
The -a says that the first argument is a message.
The processing figlet_simple.xml with the XSLT script simple2long.xsl, and
then arg.xsl you get a version of _figlet that looks like the following.
It still needs work, but it gets you part of the way and does some of
the book keeping for exclusion lists, backslashes on the help for the
constants for the -I flag. And building a case statements for the "$state".
And it works as is, no problems with syntax errors.
-FR.
#compdef figlet
#Generated by
# simple2long.xsl
# args.xsl
# For details see:
# http://www.geocities.com/f_rosencrantz/xml_completion.htm
local context state line
typeset -A opt_args
_arguments \
"(-r -l -x)-c[center justify]" \
"(-S -s -o -W)-k[use kerning]" \
"(-r -c -x)-l[left justify]" \
"(-p)-n[normal mode]" \
"(-k -S -s -W)-o[let letters overlap]" \
"(-n)-p[paragraph mode]" \
"(-c -l -x)-r[right justify]" \
"(-k -S -o -W)-s[smushed spacing]" \
"(-w)-t[use terminal width]" \
"(-I)-v[version]" \
"(-r -c -l)-x[use default justification of font]" \
"(-E)-D[use Deutsch character set]" \
"(-D)-E[use English character set]" \
"(-X -R)-L[left-to-right]" \
"(-C)-N[clear controlfile list]" \
"(-L -X)-R[right-to-left]" \
"(-k -s -o -W)-S[smush letters together or else!]" \
"(-k -S -s -o)-W[wide spacing]" \
"(-L -R)-X[use default writing direction of font]" \
"(-t)-w:output width (in columns):->Width" \
"-d:Font Directory:->dir" \
"-f:Font:->change_font" \
"(-N)-C:Control file:->change_controlfile" \
"(-v)-I: :((-1\:Normal\ operation\ \(default\)\ -v\:Version,\ copyright\
and\ usage\ information\ 0\:Version,\ copyright\ and\ usage\ information\
1\:Version\ in\ integer\ format\ 2\:Default\ font\ directory.\ 3\:Name\ of\
font\ figlet\ would\ use\ 4\:Output\ width\ in\ number\ columns.\ ))" \
"*:Handling Tag message:->message" \
&& return 0
case $state in
"change_controlfile");;
"change_font");;
"dir");;
"message");;
"Width");;
esac
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
next reply other threads:[~2002-03-24 21:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-24 21:15 Felix Rosencrantz [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-03-20 9:19 John Beppu
2002-03-20 12:13 ` Oliver Kiddle
2002-03-20 22:55 ` John Beppu
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=20020324211516.73312.qmail@web10406.mail.yahoo.com \
--to=f_rosencrantz@yahoo.com \
--cc=beppu@ax9.org \
--cc=zsh-workers@sunsite.auc.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).