From: Christian Franke <Christian.Franke@t-online.de>
To: grub-devel@gnu.org
Subject: [PATCH] Allow more than one line in option help text
Date: Fri, 23 Jan 2009 20:27:44 +0100 [thread overview]
Message-ID: <497A1A30.9@t-online.de> (raw)
[-- 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)
{
next reply other threads:[~2009-01-23 19:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-23 19:27 Christian Franke [this message]
2009-01-30 21:11 ` [PATCH] Allow more than one line in option help text Christian Franke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=497A1A30.9@t-online.de \
--to=christian.franke@t-online.de \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.