#include "options.hpp" #include #include void print_usage() { fmt::println("USAGE: bezos [-p PORT] [-h] -d deck.md"); } Options parse_options(int argc, char* argv[]) { int opt = 0; Options result; while((opt = getopt(argc, argv, "hp:d:")) != -1) { switch(opt) { case 'h': print_usage(); return {.help=true}; break; case 'p': result.port = std::stoi(optarg); break; case 'd': result.deck_given=true; result.deck_file = optarg; break; default: print_usage(); return {.error=true}; } } if(!result.deck_given) { print_usage(); result.error = true; } return result; }