zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: xmllint completion
@ 2003-02-18  6:14 Doug Kearns
  2003-02-18 10:35 ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Kearns @ 2003-02-18  6:14 UTC (permalink / raw)
  To: zsh-workers

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

Here's a new completion function for xmllint which comes with the
libxml2 library - http://xmlsoft.org/

Regards,
Doug

[-- Attachment #2: _xmllint --]
[-- Type: text/plain, Size: 2549 bytes --]

#compdef xmllint

# xmllint: using libxml version 20503

local encoding
encoding=(
  UTF-8
  UTF-16
  ISO-10646-UCS-2
  ISO-10646-UCS-4
  ISO-8859-1
  ISO-8859-2
  ISO-8859-3
  ISO-8859-4
  ISO-8859-5
  ISO-8859-6
  ISO-8859-7
  ISO-8859-8
  ISO-8859-9
  ISO-2022-JP
  SHIFT_JIS
  EUC-JP
)

_arguments \
  '--version[display the version of the XML library used]' \
  '--debug[dump a debug tree of the in-memory document]' \
  '--shell[run a navigating shell]' \
  '--debugent[debug the entities defined in the document]' \
  '--copy[used to test the internal copy implementation]' \
  '--recover[output what was parsable on broken XML documents]' \
  '--noent[substitute entity references by their value]' \
  "(--output -o)--noout[don't output the result tree]" \
  '--htmlout[output results as HTML]' \
  '--nowrap[do not put HTML doc wrapper]' \
  '--valid[validate the document in addition to std well-formed check]' \
  '(--dtdvalid --relaxng)--postvalid[do a posteriori validation, i.e after parsing]' \
  '(--postvalid --relaxng)--dtdvalid[do a posteriori validation against a given DTD]:DTD:->url' \
  '--timing[print some timings]' \
  '(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \
  '--repeat[repeat 100 times, for timing or profiling]' \
  '--insert[ad-hoc test for valid insertions]' \
  '--compress[turn on gzip compression of output]' \
  '(--html)--sgml[use the DocBook SGML parser]' \
  '(--sgml)--html[use the HTML parser]' \
  '--push[use the push mode of the parser]' \
  '--memory[parse from memory]' \
  '--nowarning[do not emit warnings from parser/validator]' \
  '--noblanks[drop (ignorable?) blanks spaces]' \
  '--format[reformat/reindent the input]' \
  '--testIO[test user I/O support]' \
  '--encode[output in the given encoding]:encoding:(${encoding[@]})' \
  '(--nocatalogs)--catalogs[use SGML catalogs]' \
  '(--catalogs)--nocatalogs[deactivate all catalogs]' \
  '--auto[generate a small doc on the fly]' \
  '--xinclude[do XInclude processing]' \
  '--loaddtd[fetch external DTD]' \
  '--dtdattr[loaddtd + populate the tree with inherited attributes]' \
  '--dropdtd[remove the DOCTYPE of the input docs]' \
  '--stream[use the streaming interface to process very large files]' \
  '--chkregister[verify the node registration code]' \
  '(--dtdvalid --postvalid)--relaxng[do RelaxNG validation against the schema]:schema:->url' \
  '*:XML file:->url' && return

if [[ "$state" = url ]]; then
  _alternative \
    'files:file:_files' \
    'urls:url:_urls' && return
fi

return 1

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

* Re: PATCH: xmllint completion
  2003-02-18  6:14 PATCH: xmllint completion Doug Kearns
@ 2003-02-18 10:35 ` Oliver Kiddle
  2003-02-18 13:45   ` Doug Kearns
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2003-02-18 10:35 UTC (permalink / raw)
  To: Doug Kearns; +Cc: zsh-workers

On 18 Feb, Doug Kearns wrote:
> 
> Here's a new completion function for xmllint which comes with the
> libxml2 library - http://xmlsoft.org/

Thanks, I've added this. We should perhaps clump it together with
_xsltproc in an _xmlsoft (any views?). An xmlcatalog completion if/when
written could go in there too.

On 4.1 only, I'll apply the following patch on top of it. It just makes
it call _webbrowser (formerly would have been _urls -f; see 16323)
instead of repeating the content of _webbrowser in a state. 16323 is not
on 4.0 so I'll just add in the missing `local state line
curcontext="$curcontext"' and _arguments -C for 4.0.

Oliver

Index: _xmllint
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_xmllint,v
retrieving revision 1.1
diff -u -r1.1 _xmllint
--- _xmllint	18 Feb 2003 10:02:55 -0000	1.1
+++ _xmllint	18 Feb 2003 10:09:15 -0000
@@ -35,7 +35,7 @@
   '--nowrap[do not put HTML doc wrapper]' \
   '--valid[validate the document in addition to std well-formed check]' \
   '(--dtdvalid --relaxng)--postvalid[do a posteriori validation, i.e after parsing]' \
-  '(--postvalid --relaxng)--dtdvalid[do a posteriori validation against a given DTD]:DTD:->url' \
+  '(--postvalid --relaxng)--dtdvalid[do a posteriori validation against a given DTD]:DTD:_webbrowser' \
   '--timing[print some timings]' \
   '(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \
   '--repeat[repeat 100 times, for timing or profiling]' \
@@ -59,13 +59,5 @@
   '--dropdtd[remove the DOCTYPE of the input docs]' \
   '--stream[use the streaming interface to process very large files]' \
   '--chkregister[verify the node registration code]' \
-  '(--dtdvalid --postvalid)--relaxng[do RelaxNG validation against the schema]:schema:->url' \
-  '*:XML file:->url' && return
-
-if [[ "$state" = url ]]; then
-  _alternative \
-    'files:file:_files' \
-    'urls:url:_urls' && return
-fi
-
-return 1
+  '(--dtdvalid --postvalid)--relaxng[do RelaxNG validation against the schema]:schema:_webbrowser' \
+  '*:XML file:_webbrowser'

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


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

* Re: PATCH: xmllint completion
  2003-02-18 10:35 ` Oliver Kiddle
@ 2003-02-18 13:45   ` Doug Kearns
  2003-02-18 14:39     ` Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Kearns @ 2003-02-18 13:45 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

On Tue, Feb 18, 2003 at 11:35:00AM +0100, Oliver Kiddle wrote:
> On 18 Feb, Doug Kearns wrote:
> > 
> > Here's a new completion function for xmllint which comes with the
> > libxml2 library - http://xmlsoft.org/
> 
> Thanks, I've added this. We should perhaps clump it together with
> _xsltproc in an _xmlsoft (any views?). An xmlcatalog completion if/when
> written could go in there too.

This sounds like a good idea to me.
 
> On 4.1 only, I'll apply the following patch on top of it. It just makes
> it call _webbrowser (formerly would have been _urls -f; see 16323)
> instead of repeating the content of _webbrowser in a state. 16323 is not
> on 4.0 so I'll just add in the missing `local state line
> curcontext="$curcontext"' and _arguments -C for 4.0.

Sorry. I'd been using '_urls -f' when I realised it was no more and added
the state - forgetting, of course, to add those lines.

Maybe _webbrowser should be made a 'Type' and named something a little
more general?

Thanks,
Doug


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

* Re: PATCH: xmllint completion
  2003-02-18 13:45   ` Doug Kearns
@ 2003-02-18 14:39     ` Oliver Kiddle
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2003-02-18 14:39 UTC (permalink / raw)
  To: Doug Kearns; +Cc: zsh-workers

On 19 Feb, you wrote:

> > Thanks, I've added this. We should perhaps clump it together with
> > _xsltproc in an _xmlsoft (any views?). An xmlcatalog completion if/when
> > written could go in there too.
> 
> This sounds like a good idea to me.

Okay, I'll do that then.

> Maybe _webbrowser should be made a 'Type' and named something a little
> more general?

Perhaps. I'd probably have left it as _urls -f but you need separate
functions for nested tag loops to work so it seemed the easiest
solution. Trouble is that _webbrowser is for the most part just used
for a bunch of web browsers, renaming might break someone's own function
and I can't think of a better name (anyone?).

Oliver


This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


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

end of thread, other threads:[~2003-02-18 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-18  6:14 PATCH: xmllint completion Doug Kearns
2003-02-18 10:35 ` Oliver Kiddle
2003-02-18 13:45   ` Doug Kearns
2003-02-18 14:39     ` 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).