commit 02b8bed7bfe94c0f048fe1d0157c36318ecf8fda parent 6ac991b721a66cf21bc4b096f7e40b780277bfa0 Author: Dominik Schmidt <das1993@hotmail.com> Date: Sun, 9 Aug 2015 16:00:32 +0200 Add an example of Fortunes-aggregate usage. Diffstat:
examples/randomFortune.d | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/examples/randomFortune.d b/examples/randomFortune.d @@ -0,0 +1,13 @@ +import dfortune; +import std.stdio; + +int main(string args[]){ + Fortunes f; + if(args.length==1){ + writeln("Usage: "~args[0]~" /path/to/fortune[/path/to/other/fortunes,...]"); + return 1; + } + f.add(args[1..$]); + writeln(f.chooseRandom(f)); + return 0; +}