poafloc

Parser Of Arguments For Lines Of Commands
git clone git://git.dimitrijedobrota.com/poafloc.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |

commit660f946bfbd9e8aa1aae6eca0d235385ef89ed45
parent0b04695a665b57bf1c7d14e9f3e8b534575705ac
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateWed, 5 Jun 2024 20:33:23 +0200

Option that requires an argument requires its name

Diffstat:
Margs.hpp|+-
Mdemo.cpp|+++++-----

2 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/args.hpp b/args.hpp

@@ -10,7 +10,7 @@ class Parser {

struct option_t {
const char *name;
char key;
bool arg;
const char *arg;
};
struct argp_t {

diff --git a/demo.cpp b/demo.cpp

@@ -54,11 +54,11 @@ int parse_opt(int key, const char *arg, void *input) {

// clang-format off
static const Parser::option_t options[] = {
{ "--debug", 'd', 0},
{ "--hex", 'h', 0},
{"--relocatable", 'r', 0},
{ "-o", 'o', 1},
{ "--place", 'p', 1},
{ "--debug", 'd', 0},
{ "--hex", 'h', 0},
{"--relocatable", 'r', 0},
{ "-o", 'o', "file"},
{ "--place", 'p', "address"},
{0},
};
// clang-format on