testinput flag as argument

master
Benjamin Kraft 2 years ago
parent a757a50b6c
commit c1df946d1e
  1. 2
      README.md
  2. 7
      src/main.cpp
  3. 1
      src/util.h

@ -10,3 +10,5 @@ Place a file called "session" with your session key cookie from https://adventof
Expects runtime arguments as days, for example:
"5 9 1" executes Days 5, 9, 1 in this order.
Add argument "T" before to use XX_testInput.txt rather than XX_input.txt

@ -50,7 +50,12 @@ int main(int argc, char *argv[]) {
auto days = getAllDays();
std::filesystem::create_directory("input");
for (int i = 1; i < argc; i++) {
int i = 1;
if (argc > 1 && std::string(argv[1]) == "T") {
useTestInput = true;
i++;
}
for (; i < argc; i++) {
int dayNum = std::stoi(argv[i]);
std::cout << "Running day " << dayNum << std::endl;
Input input = getInput(dayNum, key, useTestInput);

@ -8,3 +8,4 @@
using std::stoi, std::to_string;
using std::cout, std::endl;
using std::string, std::vector;
Loading…
Cancel
Save