digitalmars.D.learn - How can I pass an argument to rdmd --evel=
- k-five (12/12) May 07 2017 After reading about rdmd and --eval, I tried this:
- Vladimir Panteleev (2/14) May 07 2017 Currently it's not possible:
- Vladimir Panteleev (2/3) May 07 2017 https://issues.dlang.org/show_bug.cgi?id=13345
- k-five (3/22) May 07 2017 It should be possible!
- Vladimir Panteleev (2/4) May 07 2017 FWIW, you can still pass input through stdin.
- k-five (15/19) May 07 2017 Well how about --build-only?
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')
May 07 2017
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:
May 07 2017
On Sunday, 7 May 2017 at 11:11:05 UTC, Vladimir Panteleev wrote:Currently it's not possible:https://issues.dlang.org/show_bug.cgi?id=13345
May 07 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:It should be possible! rdmd --eval=, without accepting argument is useless.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:
May 07 2017
On Sunday, 7 May 2017 at 11:29:30 UTC, k-five wrote:It should be possible! rdmd --eval=, without accepting argument is useless.FWIW, you can still pass input through stdin.
May 07 2017
On Sunday, 7 May 2017 at 13:45:37 UTC, Vladimir Panteleev wrote:On Sunday, 7 May 2017 at 11:29:30 UTC, k-five wrote:Well how about --build-only? with this argument it would be better to create executable file in the current directory not in the /tmp/.rddmd-1000/ and with a name like: eval.E201596D1C1E063AACF70666A4DBE264 This is a very useful tool if had some feature of awk and some of perl Unfortunately I only for a two weeks long got involved with leaning D, if I had experience with D I make it so nicer. -e is better than --eval -n is better than --loop because a one-liner should be as short as possible. Anyways thanks for replay. Also your website: http://thecybershadow.net/d/dconf2016/ was so nice.It should be possible! rdmd --eval=, without accepting argument is useless.FWIW, you can still pass input through stdin.
May 07 2017