How can I pass an argument to rdmd --evel=

k-five via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 7 04:29:30 PDT 2017


On Sunday, 7 May 2017 at 11:11:05 UTC, Vladimir Panteleev wrote:
> On Sunday, 7 May 2017 at 10:49:25 UTC, k-five wrote:
>> After reading about rdmd and --eval, I tried this:
>>
>> rdmd --eval='auto f=File("ddoc.html");foreach(line;f.byLine) 
>> if(line.length<10) writeln(line);f.close'
>>
>> and worked!
>>
>> Now I am wonder if there is a way to pass "ddoc.html" to this 
>> one-liner? that can work with --loop.
>>
>> I mean:
>> // --loop by default has foreach(line ...
>> // like perl -n
>> rdmd --loop='if( line.length < 10 ) writeln( line );' ddoc.html
>>
>> but it is an error in syntax and rdmd says:
>> Cannot have both --eval and a program file ('ddoc.html')
>
> Currently it's not possible:

It should be possible!
rdmd --eval=, without accepting argument is useless.


More information about the Digitalmars-d-learn mailing list