changed highlighter behaviour when no input file is given

This commit is contained in:
Thomas Ave 2016-05-29 20:13:55 +02:00
parent 2d1c077303
commit 6dbb31179a
1 changed files with 5 additions and 3 deletions

View File

@ -4,12 +4,14 @@
#include <fstream>
int main(int argc, char** argv) {
ConsoleHighlighter *highlighter;
if(argc == 2) {
std::ifstream in(argv[1]);
ConsoleHighlighter highlighter(in);
highlighter.highlight(std::cout);
highlighter = new ConsoleHighlighter(in);
} else {
std::cout << "Usage: " << argv[0] << " <filename.xml>\n";
highlighter = new ConsoleHighlighter(std::cin);
}
highlighter->highlight(std::cout);
delete highlighter;
return 0;
}