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.
50 lines
1.0 KiB
50 lines
1.0 KiB
#include "options.hpp"
|
|
#include <fmt/core.h>
|
|
#include <unistd.h>
|
|
|
|
void print_usage() {
|
|
fmt::println("USAGE: bezos [-W width] [-H height] [-p PORT] [-h] [-F] [-C] -d deck.md");
|
|
}
|
|
|
|
Options parse_options(int argc, char* argv[]) {
|
|
int opt = 0;
|
|
Options result;
|
|
|
|
while((opt = getopt(argc, argv, "hpFCd:W:H:")) != -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;
|
|
case 'W':
|
|
result.pres_size.x = std::stoi(optarg);
|
|
break;
|
|
case 'H':
|
|
result.pres_size.y = std::stoi(optarg);
|
|
break;
|
|
case 'F':
|
|
result.full_screen = true;
|
|
break;
|
|
case 'C':
|
|
result.control_window = false;
|
|
break;
|
|
default:
|
|
print_usage();
|
|
return {.error=true};
|
|
}
|
|
}
|
|
|
|
if(!result.deck_given) {
|
|
print_usage();
|
|
result.error = true;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|