From ee713e5496266f074715d9a4990a36dbf2da0e8a Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 5 Apr 2018 15:53:02 +0100 Subject: Add cmd line opts to list games and describe rules --- src/main/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/main.cpp') diff --git a/src/main/main.cpp b/src/main/main.cpp index a1d1037..16a5ba1 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -4,6 +4,7 @@ #include #include "input-output/input/command_line_helper.h" +#include "input-output/input/sol_preset_types.h" #include "input-output/input/json-parsing/json_helper.h" #include "input-output/input/json-parsing/rules_parser.h" #include "input-output/output/log_helper.h" @@ -30,6 +31,17 @@ int main(int argc, const char* argv[]) { return EXIT_FAILURE; } + // If the user has asked for the list of preset game types, prints it + if (clh.get_available_game_types()) { + sol_preset_types::print_available_games(); + return EXIT_SUCCESS; + } + string game_rule_str = clh.get_describe_game_rules(); + if (!game_rule_str.empty()) { + sol_preset_types::describe_game_rules(game_rule_str); + return EXIT_SUCCESS; + } + // Generates the rules of the solitaire from the game type const optional rules = gen_rules(clh); if (!rules) return EXIT_FAILURE; -- cgit v1.2.1