All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH 1/4] parse-options: introduce OPT_PATH
Date: Mon, 23 Feb 2015 17:17:43 +0100	[thread overview]
Message-ID: <cccf3d14e5582996e5be1467849121a262f9c9f1.1424707497.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <20150223144214.GA31624@peff.net>
In-Reply-To: <cover.1424707497.git.git@drmicha.warpmail.net>

Many options are paths, but not files. Introduce OPT_PATH which does
the same path processing as OPT_FILENAME but allows to name the argument.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/technical/api-parse-options.txt | 5 +++++
 parse-options.h                               | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 1f2db31..109903c 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -187,6 +187,11 @@ There are some macros to easily define options:
 	The filename will be prefixed by passing the filename along with
 	the prefix argument of `parse_options()` to `prefix_filename()`.
 
+`OPT_PATH(short, long, &var, arg_str, description)`::
+	Introduce an option with a path argument named arg_str.
+	The filename will be prefixed by passing the filename along with
+	the prefix argument of `parse_options()` to `prefix_filename()`.
+
 `OPT_ARGUMENT(long, description)`::
 	Introduce a long-option argument that will be kept in `argv[]`.
 
diff --git a/parse-options.h b/parse-options.h
index 7940bc7..5127a5d 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -149,6 +149,8 @@ struct option {
 	  PARSE_OPT_NOARG | PARSE_OPT_NONEG, (f) }
 #define OPT_FILENAME(s, l, v, h)    { OPTION_FILENAME, (s), (l), (v), \
 				       N_("file"), (h) }
+#define OPT_PATH(s, l, v, a, h)    { OPTION_FILENAME, (s), (l), (v), \
+				       (a), (h) }
 #define OPT_COLOR_FLAG(s, l, v, h) \
 	{ OPTION_CALLBACK, (s), (l), (v), N_("when"), (h), PARSE_OPT_OPTARG, \
 		parse_opt_color_flag_cb, (intptr_t)"always" }
-- 
2.3.0.296.g32c87e1

  reply	other threads:[~2015-02-23 16:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 14:16 [PATCH] checkout: --to requires directory Michael J Gruber
2015-02-23 14:42 ` Jeff King
2015-02-23 15:01   ` Michael J Gruber
2015-02-23 16:17   ` [PATCH 0/4] OPT_{FILENAME,PATH} Michael J Gruber
2015-02-23 16:17     ` Michael J Gruber [this message]
2015-02-23 19:23       ` [PATCH 1/4] parse-options: introduce OPT_PATH Junio C Hamano
2015-02-24 15:49         ` Michael J Gruber
2015-02-23 20:06       ` Philip Oakley
2015-02-23 16:17     ` [PATCH 2/4] option-strings: use OPT_FILENAME Michael J Gruber
2015-02-23 17:44       ` Jeff King
2015-02-23 19:08       ` Junio C Hamano
2015-02-23 20:31         ` Junio C Hamano
2015-02-23 16:17     ` [PATCH 3/4] option-strings: use OPT_PATH Michael J Gruber
2015-02-23 18:26       ` Jeff King
2015-02-23 21:07         ` Junio C Hamano
2015-02-23 21:12           ` Jeff King
2015-02-23 16:17     ` [PATCH 4/4] checkout: --to requires directory Michael J Gruber
2015-02-24  0:34 ` [PATCH] " Duy Nguyen

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=cccf3d14e5582996e5be1467849121a262f9c9f1.1424707497.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /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.