* [PATCH] Allow more than one line in option help text
@ 2009-01-23 19:27 Christian Franke
2009-01-30 21:11 ` Christian Franke
0 siblings, 1 reply; 2+ messages in thread
From: Christian Franke @ 2009-01-23 19:27 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
This small patch allows '\n' in option help texts, for example:
static const struct grub_arg_option options[] = {
{"very-complex", 'c', 0,
"sorry, but this very complex option requires more\n"
"than one line to explain properly.", 0, 0},
...
};
grub> complex -h
...
-c, --very-complex sorry, but this very complex option requires more
. than one line to explain properly.
I need it for a new module :-)
Christian
2009-01-23 Christian Franke <franke@computer.org>
* normal/arg.c (grub_arg_show_help): Add indentation if '\n' appears
in option help text.
[-- Attachment #2: grub2-arg-longhelp.patch --]
[-- Type: text/x-diff, Size: 618 bytes --]
diff --git a/normal/arg.c b/normal/arg.c
index 602f7ea..42cf44e 100644
--- a/normal/arg.c
+++ b/normal/arg.c
@@ -156,10 +156,21 @@ grub_arg_show_help (grub_command_t cmd)
}
}
- while (spacing-- > 0)
- grub_putchar (' ');
+ const char * doc = opt->doc;
+ for (;;)
+ {
+ while (spacing-- > 0)
+ grub_putchar (' ');
+
+ const char * nl = grub_strchr (doc, '\n');
+ if (! nl)
+ break;
- grub_printf ("%s\n", opt->doc);
+ while (doc <= nl)
+ grub_putchar (*doc++);
+ spacing = 4 + 20;
+ }
+ grub_printf ("%s\n", doc);
switch (opt->shortarg)
{
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Allow more than one line in option help text
2009-01-23 19:27 [PATCH] Allow more than one line in option help text Christian Franke
@ 2009-01-30 21:11 ` Christian Franke
0 siblings, 0 replies; 2+ messages in thread
From: Christian Franke @ 2009-01-30 21:11 UTC (permalink / raw)
To: grub-devel
Christian Franke wrote:
> This small patch allows '\n' in option help texts, for example:
Patch simplified & committed.
Christian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-30 21:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-23 19:27 [PATCH] Allow more than one line in option help text Christian Franke
2009-01-30 21:11 ` Christian Franke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.