1 /** 
2  * DSH provides conveniences that make it easier to write simple scripts in D.
3  * 
4  * Several phobos modules are preemptively imported so that you don't need to
5  * do so in your script. Additionally, helper functions are defined which are
6  * especially useful for scripts.
7  */
8 module dsh;
9 
10 // Public imports from the standard library.
11 public import std.stdio;
12 public import std.file;
13 
14 // Import all the various utilities.
15 public import dshutils;
16 
17 /** 
18  * Convenience method to print a string, optionally with some arguments.
19  * Params:
20  *   s = The format string.
21  *   args = Any arguments to pass to the format string.
22  */
23 public void print(string, Args...)(string s, Args args) {
24     writefln(s, args);
25 }
26 
27 /** 
28  * Convenience method to print a string to stderr, optionally with some arguments.
29  * Params:
30  *   s = The format string.
31  *   args = Any arguments to pass to the format string.
32  */
33 public void error(string, Args...)(string s, Args args) {
34     stderr.writefln(s, args);
35 }
36 
37 /** 
38  * Sleeps for a specified amount of milliseconds.
39  * Params:
40  *   amount = The amount of milliseconds to sleep for.
41  */
42 public void sleepMillis(long amount) {
43     import core.thread;
44     Thread.sleep(msecs(amount));
45 }
46 
47 /** 
48  * Sleeps for a specified amount of seconds.
49  * Params:
50  *   amount = The amount of seconds to sleep for.
51  */
52 public void sleepSeconds(long amount) {
53     import core.thread;
54     Thread.sleep(seconds(amount));
55 }