[NTG-context] How to store command line arguments in ConTeXt LUA Documents?

Hans Hagen pragma at wxs.nl
Sun Mar 13 14:24:14 CET 2016


On 3/13/2016 1:43 PM, Romain Diss wrote:
> Hi all,
>
> Is it possible to store context command line arguments into lua
> variables?
>
> I found http://wiki.contextgarden.net/Command/getdocumentargument but it
> only prints the argument. I can not store it for further processing.
>
> What I would like to do is something like this:
>
> -- start of the example
> something = context.getcommandlineargument("ARG1") -- doesn't exist
> -- make some tests here to check if 'something' has the right syntax
> context.startdocument{title = something}
> context.input("knuth")
> context.stopdocument()
> -- end of the example
>
> Then, one has just to launch:
> $ context file.cld --ARG1="My first title"

environment.arguments


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list