Commit 4390954e by Aaron Leung

Adding crappy command-line options so that I can check multiple output styles…

Adding crappy command-line options so that I can check multiple output styles without recompiling. Make sure you get the command-line options right or there will be segfaults.
parent 0086b382
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <map>
#include "document.hpp" #include "document.hpp"
using namespace Sass; using namespace Sass;
...@@ -7,16 +8,27 @@ using namespace std; ...@@ -7,16 +8,27 @@ using namespace std;
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
if (argc < 2) { if (argc < 2) {
cout << "Hey, I need a file to read!" << endl; cout << "Hey, I at least need a file to read!" << endl;
return 0; return 0;
} }
Document doc(argv[1], 0); char* path;
Document::CSS_Style style = Document::nested;
for (int i = 1; i < argc; ++i) {
if (string(argv[i]) == "--style") {
string style_name(argv[++i]);
if (style_name == "nested") style = Document::nested;
else if (style_name == "expanded") style = Document::expanded;
}
else {
path = argv[i];
}
}
Document doc(path, 0);
doc.parse_scss(); doc.parse_scss();
// string output = doc.emit_css(doc.expanded); string output = doc.emit_css(style);
// cout << output;
// cout << endl;
string output = doc.emit_css(doc.nested);
cout << output; cout << output;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment