Georg Wrede wrote:
I had no idea. Good you told me, I've put an ack in the source file.
Thanks. I tried to locate the source in the dmd tree, but in vain.
So probably it should appear when rdmd is run with no arguments for
there to be any effect... :-)
It's on dsource under phobos/tools. On
http://www.digitalmars.com/d/2.0/rdmd.html, there's a "download" link.
(I have just checked it in.)
By the way, I added a couple more flags:
Usage: rdmd [RDMD AND DMD OPTIONS]... program [PROGRAM OPTIONS]...
Builds (with dependents) and runs a D program.
Example: rdmd -release myprog --myprogparm 5
Any option to be passed to dmd must occur before the program name. In
addition
to dmd options, rdmd recognizes the following options:
--build-only just build the executable, don't run it
--chatty write dmd commands to stdout before executing them
--compiler=comp use the specified compiler (e.g. gdmd) instead of dmd
Heh, had to actually use this one when I checked rdmd before posting.
Now i have dmd1 and dmd2 and obviously needed this.
--dry-run do not compile, just show what commands would be run
(implies --chatty)
--force force a rebuild even if apparently not necessary
--eval=code evaluate code a la perl -e
--loop assume "foreach (line; stdin.byLine()) { ... }"
for eval
--help this message
--man open web browser on manual page
--shebang rdmd is in a shebang line (put as first argument)
If foo.d is to be run like
$ ./foo.d
then rdmd has to be on the shebang line anyway. And if you run
$ rdmd foo.d
then you're already running rdmd. So, where do you use --shebang?
Because of the primitive way the shell parses the shebang line. Consider:
#!/usr/bin/rdmd -unittest
... code ...
All's dandy. Now say I want also -O:
#!/usr/bin/rdmd -unittest -O
... code ...
No go. The shell passes "-unittest -O" as one argument to rdmd, which is
not recognized as a flag. Always parsing the spaces away is not an
option because there are filenames and string arguments with spaces. So
I added --shebang to mean, parse the spaces in this argument:
#!/usr/bin/rdmd --shebang=-unittest -O
... code ...
Of particular interest are --eval and --loop. Very helpful :o).
Oh, these both are cool!
PS: are you using zsh? The examples on
http://www.digitalmars.com/d/2.0/rdmd.html have a percent prompt instead
of the dollar prompt. Zsh seems to be fading out, the faq
http://zsh.sourceforge.net/FAQ/zshfaq01.html is from 2005, and the last
Fedora doesn't even have zsh as an option.
Yah. I didn't know it was going away. To me it seems pretty powerful,
e.g. more so than bash. Bummer...
Andrei