If Amazon used this Bezos wouldn't have banned PowerPoint.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bezos-loves-slides/src/options.cpp

39 lines
728 B

#include "options.hpp"
#include <fmt/core.h>
#include <unistd.h>
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;
}