1 /// Author: Aziz Köksal
2 /// License: GPL3
3 /// $(Maturity average)
4 module cmd.Command;
5 
6 import common;
7 
8 /// Base class for all commands.
9 abstract class Command
10 {
11   /// Verbose output.
12   bool verbose;
13 
14   /// Logs messages to stdout.
15   /// Params:
16   ///  format = The format string.
17   void log(cstring format, ...)
18   { // TODO: use thread-safe logging classes of Tango?
19     Printfln(Format(_arguments, _argptr, format));
20   }
21 
22   /// Calls logfunc only when the verbose-flag is on.
23   void lzy(lazy void logfunc)
24   {
25     if (verbose)
26       logfunc();
27   }
28 
29   /// Runs the command.
30   void run()
31   {}
32 }