hroptatyr / yuck

Your Umbrella Command Kit, a bog-standard command line option parser for C with all the knickknackery and whatnots.
Other
61 stars 7 forks source link

"extra operand" is not handled #9

Closed rudimeier closed 8 years ago

rudimeier commented 8 years ago

I think this line

$ yuck gen --no-auto-actions=bla  ./src/yuck.yuck

should give you an error like getopt would print:

yuck: option '--no-auto-actions' doesn't allow an argument

Also would be nice to be able to create commands without any non-option arguments which automatically exit on error, like

$ hostid bla
hostid: extra operand ‘bla’
hroptatyr commented 8 years ago

Fixed in 982c082f

The second problem should be easy to do afterwards:

yuck_parse(foo, argc, argv);
if (foo->nargs) {
        fputs("Error: extra operands\n", stderr);
        exit(1);
}

Like getopt or argp, yuck is a syntax parser and leaves the semantic parsing up to the user.