if (!item->help)
return;
+ bool force_col1 = 0;
if (item->cls == OPT_CL_HELP) {
- struct help_line *l = GARY_PUSH(h->lines);
- l->extra = item->help;
- return;
+ if (item->flags & OPT_HELP_COL) {
+ force_col1 = 1;
+ } else {
+ struct help_line *l = GARY_PUSH(h->lines);
+ l->extra = item->help;
+ return;
+ }
}
if (item->letter >= OPT_POSITIONAL_TAIL)
if (eol)
*eol++ = 0;
- int field = (l == first ? 1 : 0);
+ int field = (l == first && !force_col1 ? 1 : 0);
char *f = text;
while (f) {
char *tab = strchr(f, '\t');
#define OPT_MULTIPLE 0x200 /** The option may appear multiple times; will save all the values into a simple list. **/
#define OPT_SEEN_AS_LONG 0x400 // Used internally to signal that we currently process the long form of the option
#define OPT_BEFORE_CONFIG 0x800 /** The option may appear before a config file is loaded. **/
+#define OPT_HELP_COL 0x1000 /** Used for OPT_CL_HELP to signal that tabs switch columns. **/
#define OPT_INTERNAL 0x4000 // Used internally to ask for passing of struct opt_context to OPT_CALL
/**
/** No option, just a piece of help text. **/
#define OPT_HELP(line) { .help = line, .cls = OPT_CL_HELP }
+/** Like OPT_HELP, but the help text uses tab characters to switch columns like help text for ordinary options does. **/
+#define OPT_HELP_COLUMNS(line) { .help = line, .flags = OPT_HELP_COL, .cls = OPT_CL_HELP }
+
/** Standard `--help` option. **/
#define OPT_HELP_OPTION OPT_CALL(0, "help", opt_handle_help, NULL, OPT_BEFORE_CONFIG | OPT_INTERNAL | OPT_NO_VALUE, "\tShow this help")