Thanks, Alex. Now I'm on track again, using (opt).

/Jon

On 28-10-13 11:38 , Alexander Burger wrote:
Hi Jon,

that command line arguments to work, starting with a "-". I want my
concatJsonsIntoArray.l to write its result to a file ../test.json.
How can I give that file path as an argument to my script?
It depends how you call your script. The example I gave

    (de isJSON (F)
        (= "a" (pack (stem (chop F) "."))) )

    (let Fout (opt)
       (unless Fout
          (prinl "No output file argument given")
          (bye) )
       (out Fout
           (let Sep "["
               (for Fin (dir)
                   (when (isJSON Fin)
                       (prinl Sep)
                       (in Fin (echo))
                       (setq Sep ",") ) ) )
           (prinl)
           (prinl "]") ) )
works if you call it as you did in your first mail

    $ pil ../concatJsonsIntoArray.l ../test.json +

because then (opt) is called inside "concatJsonsIntoArray.l" and it eats
up the following argument "../test.json".


I've tried to read this
<http://www.software-lab.de/doc/tut.html#script>, but it didn't help
me today.
'script' is a different thing. It is not useful to be applied to command
line arguments, because these are already implicitly handled with
'load'. 'script' _is_ 'load', just with argument binding analog to
functions with variable arguments.

In short, I would recommend to go with (opt).

♪♫ Alex

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to