git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>,
	Johannes Sixt <j.sixt@viscovery.net>,
	Yaroslav Halchenko <debian@onerussian.com>,
	Jakub Narebski <jnareb@gmail.com>
Subject: Re: [PATCH v3 1/5] parse-options: Allow PARSE_OPT_NOARG in integer arguments
Date: Fri, 20 Aug 2010 22:39:16 -0500	[thread overview]
Message-ID: <20100821033916.GA2206@burratino> (raw)
In-Reply-To: <20100820200148.GE6211@kytes>

Hi Ram,

[rearranged for convenience]
Ramkumar Ramachandra wrote:

> Let's say I want to have an option that takes an
> integer argument, say `foo`. To set it to the integer argument 42, I
> can say `--foo=42`. To set it to its default value, I could earlier
> say `--foo=`. With this patch I can simply say `--foo`. Makes sense?

I think you want OPTARG ("optional argument").

What your patch would allow is using OPTION_INTEGER for boolean
options, where people use OPT_SET_INT now.  Maybe that would be a good
cleanup, but I am not convinced it is worth the churn.

> Junio C Hamano writes:

>> Doesn't NOARG mean "Do not take an argument, if you give me an argument
>> that is an error"?
>
> Oh, does it mean that?

Yes.

-- 8< --
Subject: parse-options: clarify PARSE_OPT_NOARG description

Here "takes no argument" means "does not take an argument".  The
latter phrasing might make it clearer that PARSE_OPT_NOARG does not
make an option with an argument that can optionally be left off.

Noticed-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/parse-options.h b/parse-options.h
index 7435cdb..d982f0f 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -69,7 +69,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
  * `flags`::
  *   mask of parse_opt_option_flags.
  *   PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)
- *   PARSE_OPT_NOARG: says that this option takes no argument
+ *   PARSE_OPT_NOARG: says that this option does not take an argument
  *   PARSE_OPT_NONEG: says that this option cannot be negated
  *   PARSE_OPT_HIDDEN: this option is skipped in the default usage, and
  *                     shown only in the full usage.
-- 

  reply	other threads:[~2010-08-21  3:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 19:14 [PATCH v3 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-20 19:14 ` [PATCH v3 1/5] parse-options: Allow PARSE_OPT_NOARG in integer arguments Ramkumar Ramachandra
2010-08-20 19:49   ` Junio C Hamano
2010-08-20 20:01     ` Ramkumar Ramachandra
2010-08-21  3:39       ` Jonathan Nieder [this message]
2010-08-20 19:14 ` [PATCH v3 2/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
2010-08-21  3:54   ` Jonathan Nieder
2010-08-21  5:55     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 3/5] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
2010-08-21  4:02   ` Jonathan Nieder
2010-08-21  5:51     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 4/5] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
2010-08-21  4:04   ` Jonathan Nieder
2010-08-21  5:49     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 5/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra

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=20100821033916.GA2206@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=debian@onerussian.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=jnareb@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).