aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 70a3ffc..009aac5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,13 +8,18 @@ class Param : public ParamProc
8{ 8{
9public: 9public:
10 Param() : 10 Param() :
11 sFile("build.conf") 11 sFile("build.conf"),
12 sCache("build.cache")
12 { 13 {
13 addHelpBanner("Build r?\n\n"); 14 addHelpBanner("Build r?\n\n");
14 addParam("file", 'f', &sFile, 15 addParam("file", 'f', &sFile,
15 "Set the input script, default: build.conf"); 16 "Set the input script, default: build.conf");
16 addParam('p', mkproc(Param::procViewPercent), 17 addParam('p', mkproc(Param::procViewPercent),
17 "Switch to percent view."); 18 "Switch to percent view.");
19 addParam("cache", &sCache,
20 "Set an alternative cache file." );
21 addParam('d', &bDebug,
22 "Print out a debug dump of the read build.conf", "true" );
18 addParam("help", mkproc(ParamProc::help), 23 addParam("help", mkproc(ParamProc::help),
19 "This help"); 24 "This help");
20 pViewer = new ViewerPlain; 25 pViewer = new ViewerPlain;
@@ -42,9 +47,11 @@ public:
42 pViewer = new ViewerPercent; 47 pViewer = new ViewerPercent;
43 } 48 }
44 49
50 std::string sCache;
45 std::string sFile; 51 std::string sFile;
46 StaticString sAction; 52 StaticString sAction;
47 Viewer *pViewer; 53 Viewer *pViewer;
54 bool bDebug;
48 55
49private: 56private:
50}; 57};
@@ -56,14 +63,20 @@ int main( int argc, char *argv[] )
56 63
57 Builder bld( *prm.pViewer ); 64 Builder bld( *prm.pViewer );
58 65
66 bld.setCache( prm.sCache );
59 bld.load( prm.sFile.c_str() ); 67 bld.load( prm.sFile.c_str() );
60 68
61 if( prm.sAction > 0 ) 69 if( prm.bDebug )
62 bld.build( prm.sAction ); 70 {
71 printf("\n\n----------\nDebug dump\n----------\n");
72 bld.debug();
73 }
63 else 74 else
64 bld.build(); 75 {
65/* 76 if( prm.sAction > 0 )
66 printf("\n\n----------\nDebug dump\n----------\n"); 77 bld.build( prm.sAction );
67 bld.debug();*/ 78 else
79 bld.build();
80 }
68} 81}
69 82