diff --git a/include/command_line_interface.h b/include/command_line_interface.h index db6206c..89ce958 100644 --- a/include/command_line_interface.h +++ b/include/command_line_interface.h @@ -88,6 +88,6 @@ namespace Hanabi { /** * @brief Execute parsed parameters. */ - int run_cli(CLIParms parms); + int run_cli(CLIParms const & parms); } #endif //DYNAMIC_PROGRAM_COMMAND_LINE_INTERFACE_H diff --git a/src/command_line_interface.cpp b/src/command_line_interface.cpp index e3e3283..b748e82 100644 --- a/src/command_line_interface.cpp +++ b/src/command_line_interface.cpp @@ -32,7 +32,7 @@ namespace Hanabi { } } - int run_cli(CLIParms parms) + int run_cli(CLIParms const & parms) { // We want to do this sanity check here again, // so that the run_cli method itself can ensure that arguments are fully valid @@ -49,12 +49,6 @@ namespace Hanabi { std::ostream & quiet_os = quiet_ostream(parms.quiet); quiet_os.precision(10); - // Convert unset option to useful default, depending on some other options - if (not parms.interactive.has_value()) - { - parms.interactive = !(parms.quiet or parms.recursive); - } - // Load game, either from file or from hanab.live Game game = Download::get_game(parms.game, convert_optional(parms.score_goal)); if (not game.holds_state()) @@ -176,7 +170,7 @@ namespace Hanabi { quiet_os << "Enumerated " << game.state->position_tablebase().size() << " unique game states. " << std::endl; // If specified, we can now launch the interactive shell - if (parms.interactive) + if (parms.interactive.value_or(!parms.quiet)) { quiet_os << "\nDropping into interactive command line to explore result (type 'help'):" << std::endl; auto game_shared = std::shared_ptr(game.state.release());