Bind context item to stdin in zorbacmd

Bug #1042992 reported by mb21
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
New
Medium
Sorin Marian Nasoi

Bug Description

After fixing bug #1025564, the only step left to make zorba a great command line tool would be to bind the context item (.) to the stdin. Then you could do stuff like:

echo '<root><a>1</a><a>5</a><root>' | zorba -q "sum(./a)" > out.txt

To implement this, one probably needs to check whether the context item is an unbound variable, and if it is, bind it to stdin and maybe write to stderr: "Waiting for input from stdin..." (in case somebody uses the dot in his XQuery program but doesn't realize he has to pipe something in).
On the other hand, if the context item is not an unbound variable (i.e. it isn't used at all, or manually bound to something), then do nothing.

mb21 (mauro-bieg)
description: updated
Changed in zorba:
importance: Undecided → Wishlist
Changed in zorba:
assignee: nobody → Sorin Marian Nasoi (sorin.marian.nasoi)
importance: Wishlist → Medium
Revision history for this message
Chris Hillery (ceejatec) wrote :

An alternate approach would be to accept "-" as an argument to --context-item. That would make it explicit at the cost of being a bit more verbose. A similar approach could be used to bind stdin to external variables, eg. "-e myvar=-".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.