TheBrokenRail
4d54a9d28c
Some checks failed
CI / Build (AMD64, Server) (push) Successful in 13m26s
CI / Build (AMD64, Client) (push) Successful in 13m45s
CI / Build (ARM64, Server) (push) Successful in 14m6s
CI / Build (ARM64, Client) (push) Successful in 16m50s
CI / Build (ARMHF, Server) (push) Successful in 9m35s
CI / Build (ARMHF, Client) (push) Successful in 12m27s
CI / Test (Server) (push) Successful in 15m7s
CI / Test (Client) (push) Successful in 16m38s
CI / Release (push) Has been skipped
CI / Build Example Mods (push) Failing after 8m12s
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#include <argp.h>
|
|
|
|
#include "parser.h"
|
|
|
|
// Globals
|
|
const char *argp_program_version = "Reborn v" MCPI_VERSION;
|
|
const char *argp_program_bug_address = "<" MCPI_DISCORD_INVITE ">";
|
|
static char doc[] = "Minecraft: Pi Edition Modding Project";
|
|
|
|
// Options
|
|
#define OPTION(ignored, name, key, doc) {name, key, nullptr, 0, doc, 0},
|
|
static argp_option options_data[] = {
|
|
#include "option-list.h"
|
|
{nullptr, 0, nullptr, 0, nullptr, 0}
|
|
};
|
|
#undef OPTION
|
|
|
|
// Parse Options
|
|
#define OPTION(name, ignored, key, ...) \
|
|
case key: \
|
|
options->name = true; \
|
|
break;
|
|
static error_t parse_opt(int key, __attribute__((unused)) char *arg, argp_state *state) {
|
|
options_t *options = (options_t *) state->input;
|
|
switch (key) {
|
|
#include "option-list.h"
|
|
default:
|
|
return ARGP_ERR_UNKNOWN;
|
|
}
|
|
return 0;
|
|
}
|
|
#undef OPTION
|
|
static argp argp = {options_data, parse_opt, nullptr, doc, nullptr, nullptr, nullptr};
|
|
options_t parse_options(int argc, char *argv[]) {
|
|
options_t options = {};
|
|
argp_parse(&argp, argc, argv, 0, nullptr, &options);
|
|
return options;
|
|
} |