All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlos Rica <jasampler@gmail.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Pierre Habouzit <madcoder@debian.org>
Subject: Re: [PATCH] Fix documentation syntax of optional arguments in short options.
Date: Wed, 09 Apr 2008 13:07:14 +0200	[thread overview]
Message-ID: <47FCA362.3090607@gmail.com> (raw)
In-Reply-To: <47FC4510.6080904@gmail.com>

When an argument for an option is optional, like in -n from git-tag,
puting a space between the option and the argument is interpreted
as a missing argument for the option plus an isolated argument.
Documentation now reflects the need to write the parameter following
the option -n, as in "git tag -nARG", for instance.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
---

   I forgot to make the same change to the command's syntax in builtin-tag.c.

   I didn't check if this also happens for OPTION_STRING, this is only for
   OPTION_INTEGER, which seems to be only used in git-tag. I must note that
   all this is related to the PARSE_OPT_OPTARG option, which is used only
   (apart from builtin-tag.c) in builtin-rev-parse.c but in a different way.

 Documentation/git-tag.txt |    4 ++--
 builtin-tag.c             |    2 +-
 parse-options.c           |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index c22fb71..4b6fd90 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git-tag' [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>]  <name> [<head>]
 'git-tag' -d <name>...
-'git-tag' [-n [<num>]] -l [<pattern>]
+'git-tag' [-n[<num>]] -l [<pattern>]
 'git-tag' -v <name>...

 DESCRIPTION
@@ -57,7 +57,7 @@ OPTIONS
 -v::
 	Verify the gpg signature of the given tag names.

--n <num>::
+-n<num>::
 	<num> specifies how many lines from the annotation, if any,
 	are printed when using -l.
 	The default is not to print any annotation lines.
diff --git a/builtin-tag.c b/builtin-tag.c
index 8dd959f..129ff57 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -16,7 +16,7 @@
 static const char * const git_tag_usage[] = {
 	"git-tag [-a|-s|-u <key-id>] [-f] [-m <msg>|-F <file>] <tagname> [<head>]",
 	"git-tag -d <tagname>...",
-	"git-tag -l [-n [<num>]] [<pattern>]",
+	"git-tag -l [-n[<num>]] [<pattern>]",
 	"git-tag -v <tagname>...",
 	NULL
 };
diff --git a/parse-options.c b/parse-options.c
index e87cafb..acf3fe3 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -344,7 +344,7 @@ void usage_with_options_internal(const char * const *usagestr,
 			break;
 		case OPTION_INTEGER:
 			if (opts->flags & PARSE_OPT_OPTARG)
-				pos += fprintf(stderr, " [<n>]");
+				pos += fprintf(stderr, "[<n>]");
 			else
 				pos += fprintf(stderr, " <n>");
 			break;
-- 
1.5.3.4

      reply	other threads:[~2008-04-09 11:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09  4:24 [PATCH] Fix documentation syntax of optional arguments in short options Carlos Rica
2008-04-09 11:07 ` Carlos Rica [this message]

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=47FCA362.3090607@gmail.com \
    --to=jasampler@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madcoder@debian.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.