" del Delete TLV key\n" \
" list List available TLV keys"
+/*
+ * Define integer key provided by the usage option to the option parser as a
+ * non-ASCII character, so that it doesn't display a short option.
+ */
+#define USAGE_KEY 0x123
+
/* The options we understand. */
static struct argp_option argp_options[] = {
{"addr", 'a', "num", 0, "I2C device address", 0},
{"dev", 'd', "path", 0, "EEPROM device path (if not using I2C bus/addr)", 0},
{"key", 'k', "key", 0, "TLV key", 0},
{"value", 'v', "val", 0, "TLV value (string)", 0},
+ {"help", 'h', 0, 0, "Give this help list", -1},
+ {"usage", USAGE_KEY, 0, 0, "Give a short usage message", -1},
{ 0 }
};
case 'd':
options.eeprom_path = arg;
break;
+ case 'h':
+ argp_state_help(state, state->out_stream, ARGP_HELP_STD_HELP);
+ exit(0);
+ break;
+ case USAGE_KEY:
+ argp_state_help(state, state->out_stream, ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
+ exit(0);
+ break;
case 'k':
decode_int(arg, state, &options.tlv_key);
break;
options.tlv_value = NULL;
/* Parse our arguments. */
- rc = argp_parse(&argp, argc, argv, 0, 0, NULL);
+ rc = argp_parse(&argp, argc, argv, ARGP_NO_HELP, 0, NULL);
if (rc != 0)
log_fail("Failed to parse command line arguments\n");