{
case ARGPAR_ERROR_TYPE_MISSING_OPT_ARG:
{
- int orig_index = argpar_error_orig_index(error);
+ const int orig_index = argpar_error_orig_index(error);
const char *arg = argv[orig_index];
ret = strutils_appendf(&str,
}
case ARGPAR_ERROR_TYPE_UNKNOWN_OPT:
{
+ int orig_index = argpar_error_orig_index(error);
const char *unknown_opt = argpar_error_unknown_opt_name(error);
ret = strutils_appendf(&str,
- "Unknown option `%s`", unknown_opt);
+ WHILE_PARSING_ARG_N_ARG_FMT "Unknown option `%s`",
+ orig_index + 1, argv[orig_index], unknown_opt);
if (ret < 0) {
goto end;
test_failure "no args" "Error: Missing --condition."
test_failure "unknown option" \
- "Error: Unknown option \`--hello\`" \
+ "Error: While parsing argument #1 (\`--hello\`): Unknown option \`--hello\`" \
--hello
test_failure "missing --action" \