From d4b193e6e7fdefc66d9698337581b960c30844ea Mon Sep 17 00:00:00 2001 From: Feffernoose Date: Sun, 6 Oct 2013 20:16:40 -0400 Subject: Removed yamlcpp dependency from rawr-gen rawr-gen now takes the input corpus as a command-line argument, so as to increase the ease-of-use. It also now shows a usage message if provided with a non-existent file or no argument. --- gen.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'gen.cpp') diff --git a/gen.cpp b/gen.cpp index dc73e0f..e4a58e5 100644 --- a/gen.cpp +++ b/gen.cpp @@ -7,18 +7,34 @@ #include #include #include -#include -#include using namespace::std; int main(int argc, char** args) { srand(time(NULL)); - - YAML::Node config = YAML::LoadFile("config.yml"); - - ifstream infile(config["corpus"].as().c_str()); + + if (argc == 1) + { + cout << "rawr-gen, version 1.0" << endl; + cout << "Usage: rawr-gen corpus-file" << endl; + cout << " where 'corpus-file' is the path to your input" << endl; + + return 0; + } + + ifstream infile(args[1]); + if (!infile) + { + cout << "rawr-gen, version 1.0" << endl; + cout << "Usage: rawr-gen corpus-file" << endl; + cout << " where 'corpus-file' is the path to your input" << endl; + cout << endl; + cout << "The file you specified does not exist." << endl; + + return 0; + } + string corpus; string line; while (getline(infile, line)) -- cgit 1.4.1