Skip to content

Commit

Permalink
Modernize rdmd's synopsis
Browse files Browse the repository at this point in the history
  • Loading branch information
wilzbach committed Mar 24, 2018
1 parent 36f7800 commit 2a455b5
Showing 1 changed file with 32 additions and 17 deletions.
49 changes: 32 additions & 17 deletions rdmd.dd
Expand Up @@ -5,33 +5,38 @@ $(D_S rdmd,
$(H2 Synopsis)

In a command prompt:
<pre>
% cat myprog.d

$(CONSOLE > cat myprog.d)
---
import std.stdio;
void main()
{
writeln("Hello, world without explicit compilations!");
}
% rdmd myprog
---
$(CONSOLE
> rdmd myprog
Hello, world without explicit compilations!
% <blink>_</blink>
</pre>
)

Inside a D program:
<pre>
% cat myprog.d

$(CONSOLE > cat myprog.d)
---
#!/usr/bin/env rdmd
import std.stdio;
void main()
{
writeln("Hello, world with automated script running!");
}
% ./myprog.d
---

$(CONSOLE
> ./myprog.d
Hello, world with automated script running!
% <blink>_</blink>
</pre>
)

(Under Windows replace $(B cat) with $(B type) and $(B
$(MESSAGE_BOX gray, $(B Windows): replace $(B cat) with $(B type) and $(B
#!/usr/bin/env rdmd) with $(B #!rdmd), the latter assuming that $(B rdmd)
can be found in your path.)

Expand Down Expand Up @@ -68,8 +73,8 @@ source file does not produce the executable again.)

$(H2 Usage)

$(P
$(B rdmd) [$(I dmd and rdmd options)] $(I progfile)[.d] [$(I program arguments)]
$(CONSOLE
$(B rdmd) [$(I dmd and rdmd options)] $(I progfile)[.d] [$(I program arguments)]
)

$(P In addition to $(LINK2 $(ROOT_DIR)dmd.html, `dmd`)'s options, $(B rdmd) recognizes the following:
Expand All @@ -88,8 +93,11 @@ compiler (e.g. gdmd) instead of dmd)
$(DT $(B --dry-run)) $(DD do not compile, just show what commands
would be run (implies --chatty))

$(DT $(B --eval)=code) $(DD evaluate code including it in $(D_PARAM
void main(char[][] args) { ... }) (multiple --eval allowed, will be
$(DT $(B --eval)=code) $(DD evaluate code including it in
---
void main(char[][] args) { ... }
---
(multiple --eval allowed, will be
evaluated in turn))

$(DT $(B --exclude)=package) $(DD exclude a package from the build (multiple --exclude allowed))
Expand All @@ -104,9 +112,16 @@ necessary)
$(DT $(B --help)) $(DD show a help message and exit)

$(DT $(B --loop)=code) $(DD like --eval, but code will be additionally
included in a loop $(D_PARAM foreach (line; stdin.byLine()) { ... }))
included in a loop
---
foreach (line; stdin.byLine()) { ... }
---
)

$(DT $(B --main)) $(DD add an empty $(D_PARAM void main() {}) function
$(DT $(B --main)) $(DD add an empty
---
void main() {}
---
(useful for running unittests))

$(DT $(B --makedepend)) $(DD print dependencies in makefile format and exit)
Expand Down

0 comments on commit 2a455b5

Please sign in to comment.