zsh-workers
 help / color / mirror / code / Atom feed
* optioninfo.so
@ 2000-04-13  6:51 Tanaka Akira
  2000-04-13  7:03 ` optioninfo.so Andrej Borsenkow
  0 siblings, 1 reply; 4+ messages in thread
From: Tanaka Akira @ 2000-04-13  6:51 UTC (permalink / raw)
  To: zsh-workers

Hi.  I made simple shared library for extracting information of
options by overrinding getopt_long.

Z(4):akr@serein% make
gmake: `optioninfo.so' is up to date.
Z(4):akr@serein% _ls_arguments=($(LD_PRELOAD=$PWD/optioninfo.so ls))
Z(4):akr@serein% _ls () { _arguments $_ls_arguments '*:file: _files' }
Z(4):akr@serein% compdef _ls ls                                       
Z(4):akr@serein% ls -<TAB>
option
--all           --hide-control-chars   --reverse              -D   -a   -o 
--almost-all    --human-readable       --show-control-chars   -F   -b   -p 
--block-size    --ignore               --si                   -G   -c   -q 
--classify      --ignore-backups       --size                 -H   -d   -r 
--color         --indicator-style      --sort                 -I   -e   -s 
--dereference   --inode                --tabsize              -L   -f   -t 
--directory     --kilobytes            --time                 -N   -g   -u 
--dired         --literal              --version              -Q   -h   -v 
--escape        --no-group             --width                -R   -i   -w 
--file-type     --numeric-uid-gid      -1                     -S   -k   -x 
--format        --quote-name           -A                     -T   -l      
--full-time     --quoting-style        -B                     -U   -m      
--help          --recursive            -C                     -X   -n      
Z(4):akr@serein% uname -a
Linux serein.m17n.org 2.2.14-5k4 #1 Sun Mar 12 15:33:30 PST 2000 i686 unknown

Although this is not so sophisticated now and it is not portable, it
is very useful in some case.  How about this?

begin 644 optioninfo.tar.gz
M'XL("$AM]3@"`V]P=&EO;FEN9F\N=&%R`.V6VT[;0!"&?9M]BA$'Q2$.V`YQ
MI*2A4$HK*DI::*\HBMR-G5@$;V2O.:CBW;L;V_&A):$JC8HTWXWCF=E9[S\S
MCMF4>\SW?)?M?+2O'->;.,ISHQNZ;NWN*KK>:EGM9NX:8YJ6HK?U=LNT6I8A
M?AM-W6HKH"LK(`JY'0`H]E6P,&Z9_X5R?G9X#CU@\S;8IJ3_YD/)Q@@Y?'=R
M\%Z:&^[4HX3DO"'KP(8J5]5(93*$1CBV`T=<&6SLIQX@9.1PL6I;1">_**E0
M&B>$!LVL1$%61%;&G7P/K'+^FRV]F9O_MIS_MF7@_*^"=<^GDVCHP*N0#SVV
M/=XCF2D92&$CZT/QW^`[T/_TY;A_.CCMGQY5]++U[.CSU^.SH[<5H^R)+P<G
M%9,0(3@7`W_#O"&$8Q;P0=QY*@'P?)Z\=[3DCM]/G1KY(>ZF@;AWU;7&)EW3
MDJA:5SC"6X_3,:BS4)"AU`X+C]H1-H#O@6-?=4G)GSYT'.-.(QZJ:QT[&$77
MCL\[8BNA#(OX;*O'DJ3G*R1I/);E09XF$L]L!VKUFU\5QH>B+A/FCW*R4.:'
M'&0\;"V5I[$9_G-]>L\B4._/!(H[AMJ^5";DXKRCWX@3.V)-;L?B>T;-66>G
M%\JYH,Z-%\8E]'I0[51K,V?9;<[=R6I)H7&S#;3R><635^9>J/>@V4UR/"17
M9R)4>GKBM!R_)#:+B65:LC!EO:[E>R`17N@L^RH>_70D19FH[+A8Y%AP8;NY
MN-06%Z!4K<PK-W/N/*[JY=K*UI=Q66G%DHBF[P782@/B'5P6@-J%U-C8\^UK
M)[NOU].JY4>J&*TE.F76L1T.Q/EDW75XG5<).HN"C2PXK=/B!6:V(.V8^8(E
MM9D)]1<%TI;IF[YB9@;/'SIW3ZAIL83S4I7+73K&@/F3^Y=Z%OR(1!`$01`$
901`$01`$01`$01`$0?X;?@+UR43>`"@`````
`
end
-- 
Tanaka Akira


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

* RE: optioninfo.so
  2000-04-13  6:51 optioninfo.so Tanaka Akira
@ 2000-04-13  7:03 ` Andrej Borsenkow
  2000-04-13  7:32   ` optioninfo.so Tanaka Akira
  2000-04-13  9:26   ` optioninfo.so Oliver Kiddle
  0 siblings, 2 replies; 4+ messages in thread
From: Andrej Borsenkow @ 2000-04-13  7:03 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers


> Z(4):akr@serein% _ls_arguments=($(LD_PRELOAD=$PWD/optioninfo.so ls))
                                    ^^^^^^^^^^ argh!
>
> Although this is not so sophisticated now and it is not portable, it
> is very useful in some case.  How about this?
>

Yes, it is not very portable. Do you suggest to use it outside of Zsh?
Or in Zsh completion? If it can be made Zsh module - why not. But
please, no PRELOAD fiddling.

-andrej


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

* Re: optioninfo.so
  2000-04-13  7:03 ` optioninfo.so Andrej Borsenkow
@ 2000-04-13  7:32   ` Tanaka Akira
  2000-04-13  9:26   ` optioninfo.so Oliver Kiddle
  1 sibling, 0 replies; 4+ messages in thread
From: Tanaka Akira @ 2000-04-13  7:32 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: zsh-workers

In article <000601bfa516$701681d0$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> Yes, it is not very portable. Do you suggest to use it outside of Zsh?
> Or in Zsh completion? If it can be made Zsh module - why not. But
> please, no PRELOAD fiddling.

Zsh completion system should work without LD_PRELOAD.  But is there a
reason that the system automatically detect LD_PRELOAD and use it only
when it is working?  Of couse, if there is no way to detect that, it
should be disabled by default.

Writing a completion function which supports various versions of a
command is very difficult.  (See _patch, _telnet, _finger, _make,
etc.)  So I think it is useful even if it is not work on every
environment.

Also, it may be useful for writing template of completion functions if
a completion function writer can use LD_PRELOAD. :-)
-- 
Tanaka Akira


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

* Re: optioninfo.so
  2000-04-13  7:03 ` optioninfo.so Andrej Borsenkow
  2000-04-13  7:32   ` optioninfo.so Tanaka Akira
@ 2000-04-13  9:26   ` Oliver Kiddle
  1 sibling, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2000-04-13  9:26 UTC (permalink / raw)
  To: zsh-workers

Andrej Borsenkow wrote:
> 
> > Z(4):akr@serein% _ls_arguments=($(LD_PRELOAD=$PWD/optioninfo.so ls))
>                                     ^^^^^^^^^^ argh!
> >
> > Although this is not so sophisticated now and it is not portable, it
> > is very useful in some case.  How about this?

> Yes, it is not very portable. Do you suggest to use it outside of Zsh?
> Or in Zsh completion? If it can be made Zsh module - why not. But
> please, no PRELOAD fiddling.

I think it is a very nice idea and with a bit of thought and effort, we
should be able to make good use of it for the completion system. I don't
have a problem with PRELOAD fiddling.

The principle of pre-loading works on a number of platforms but I think
the specifics of it vary. On IRIX, it is something like _RLD_LIST, I
have the exact details somewhere. Where is the real getopt_long going to
be on non-Linux systems? Is it staticly compiled into and GNU binaries
and if so, will preloading still work?

What we will probably need to do is use a wrapper script around this. It
could take the same arguments as _arguments. Where we can't use
preloading, it could just pass everything straight through to
_arguments. Otherwise it would have to take the options from
optioninfo.so and merge them with the arguments we passed. This would
allow us to get at any descriptions. We would also need to account for
programs which use getopt_long but don't have a specific completion.
Another consideration is that the programs will need to be called in a
safe way so some might need a --help option.

Oliver


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

end of thread, other threads:[~2000-04-13  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-13  6:51 optioninfo.so Tanaka Akira
2000-04-13  7:03 ` optioninfo.so Andrej Borsenkow
2000-04-13  7:32   ` optioninfo.so Tanaka Akira
2000-04-13  9:26   ` optioninfo.so Oliver Kiddle

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