diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 19:28:36 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-12-13 19:28:36 -0500 |
commit | 3da97fc4dbdd5418999645b58fd73c6ab8f6f5f4 (patch) | |
tree | 8d4655a90154aa3170d6e08b27c3283c9ba7757c | |
parent | 9debe618dd743c9b3f6d316c69fa1cc051a97d5e (diff) | |
download | manifesto-3da97fc4dbdd5418999645b58fd73c6ab8f6f5f4.tar.gz manifesto-3da97fc4dbdd5418999645b58fd73c6ab8f6f5f4.tar.bz2 manifesto-3da97fc4dbdd5418999645b58fd73c6ab8f6f5f4.zip |
Bot now takes path to config file as argument
-rw-r--r-- | manifesto.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/manifesto.cpp b/manifesto.cpp index 6b59213..b81c66a 100644 --- a/manifesto.cpp +++ b/manifesto.cpp | |||
@@ -7,7 +7,14 @@ | |||
7 | 7 | ||
8 | int main(int argc, char** argv) | 8 | int main(int argc, char** argv) |
9 | { | 9 | { |
10 | YAML::Node config = YAML::LoadFile("config.yml"); | 10 | if (argc != 2) |
11 | { | ||
12 | std::cout << "usage: manifesto [configfile]" << std::endl; | ||
13 | return -1; | ||
14 | } | ||
15 | |||
16 | std::string configfile(argv[1]); | ||
17 | YAML::Node config = YAML::LoadFile(configfile); | ||
11 | 18 | ||
12 | twitter::auth auth; | 19 | twitter::auth auth; |
13 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); | 20 | auth.setConsumerKey(config["consumer_key"].as<std::string>()); |
@@ -47,7 +54,7 @@ int main(int argc, char** argv) | |||
47 | 54 | ||
48 | loc += 140; | 55 | loc += 140; |
49 | { | 56 | { |
50 | std::ofstream fout("config.yml"); | 57 | std::ofstream fout(configfile); |
51 | config["current_location"] = loc; | 58 | config["current_location"] = loc; |
52 | fout << config; | 59 | fout << config; |
53 | } | 60 | } |