summary refs log tree commit diff stats
path: root/main.cpp
blob: a0ba7bb778cca1a50d3c984a1498829993755fc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <Magick++.h>
#include <tclap/CmdLine.h>

#include <iostream>
#include <string>

#include "wizard.h"

int main(int argc, char** argv) {
  Magick::InitializeMagick(nullptr);

  std::random_device randomDevice;
  std::mt19937 rng(5);  // randomDevice());

  try {
    TCLAP::CmdLine cmd("Spelling things with MTG cards", ' ', "1.0");

    TCLAP::ValueArg<std::string> cardsPath("c", "cards",
                                           "Path to the card definitions file",
                                           true, "", "filename");
    cmd.add(cardsPath);

    TCLAP::ValueArg<std::string> cachePath(
        "i", "image-cache", "Path to store cached card image downloads", true,
        "", "filename");
    cmd.add(cachePath);

    TCLAP::ValueArg<std::string> outputPath(
        "o", "output", "Path to write image output to", true, "", "filename");
    cmd.add(outputPath);

    TCLAP::ValueArg<std::string> jsonPath(
        "j", "json", "Path to write JSON output to", false, "", "filename");
    cmd.add(jsonPath);

    cmd.parse(argc, argv);

    wizard app(cardsPath.getValue(), cachePath.getValue(),
               outputPath.getValue(), jsonPath.getValue(), rng);

    app.run();
  } catch (const TCLAP::ArgException& e) {
    std::cerr << "Error: " << e.error() << " for arg " << e.argId()
              << std::endl;
  }
}