[PATCH] api-parse-options.txt: document OPT_CMDMODE()

Subsystems: documentation, the rest

STALE3741d

4 messages, 1 author, 2016-06-15 · open the first message on its own page

[PATCH] api-parse-options.txt: document OPT_CMDMODE()

From: Pranit Bauva <hidden>
Date: 2016-06-15 23:08:55

OPT_CMDMODE() was introduced in the release of 1.8.5 which makes the use
of subcommands in the form of arguments a lot cleaner and easier.
---
 Documentation/technical/api-parse-options.txt | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 5f0757d..8130d26 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -231,6 +231,12 @@ There are some macros to easily define options:
 	pass the command-line option, which can be specified multiple times,
 	to another command.
 
+`OPT_CMDMODE(short, long, &int_var, description, enum_val)`::
+	Introduce an option for subcommands. It is useful when you want to use
+	the command with a particular sub command only and ignore other sub
+	commands it has. It will set `int_var` to enum_val if the argument is
+	invoked.
+
 
 The last element of the array must be `OPT_END()`.
 

--
https://github.com/git/git/pull/219

[PATCH v2] api-parse-options.txt: document OPT_CMDMODE()

From: Pranit Bauva <hidden>
Date: 2016-06-15 23:08:58

OPT_CMDMODE mechanism was introduced in the release of 1.8.5 to actively
notice when multiple "operation mode" options that specify mutually
incompatible operation modes are given.

Signed-off-by: Pranit Bauva <redacted>
---
 Documentation/technical/api-parse-options.txt | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 5f0757d..695bd4b 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -231,6 +231,13 @@ There are some macros to easily define options:
 	pass the command-line option, which can be specified multiple times,
 	to another command.
 
+`OPT_CMDMODE(short, long, &int_var, description, enum_val)`::
+	Define an "operation mode" option, only one of which in the same
+	group of "operating mode" options that share the same `int_var`
+	can be given by the user. `enum_val` is set to `int_var` when the
+	option is used, but an error is reported if other "operating mode"
+	option has already set its value to the same `int_var`.
+
 
 The last element of the array must be `OPT_END()`.
 

--
https://github.com/git/git/pull/219

Re: [PATCH v2] api-parse-options.txt: document OPT_CMDMODE()

From: Pranit Bauva <hidden>
Date: 2016-06-15 23:08:58

I have used bits from your email. I forgot to add "Helped-by: Junio C
Hamano [off-list ref]" . Could you squash it in?

On Sat, Mar 26, 2016 at 12:28 AM, Pranit Bauva [off-list ref] wrote:
quoted hunk
OPT_CMDMODE mechanism was introduced in the release of 1.8.5 to actively
notice when multiple "operation mode" options that specify mutually
incompatible operation modes are given.

Signed-off-by: Pranit Bauva <redacted>
---
 Documentation/technical/api-parse-options.txt | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 5f0757d..695bd4b 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -231,6 +231,13 @@ There are some macros to easily define options:
        pass the command-line option, which can be specified multiple times,
        to another command.

+`OPT_CMDMODE(short, long, &int_var, description, enum_val)`::
+       Define an "operation mode" option, only one of which in the same
+       group of "operating mode" options that share the same `int_var`
+       can be given by the user. `enum_val` is set to `int_var` when the
+       option is used, but an error is reported if other "operating mode"
+       option has already set its value to the same `int_var`.
+

 The last element of the array must be `OPT_END()`.


--
https://github.com/git/git/pull/219
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[PATCH v3] api-parse-options.txt: document OPT_CMDMODE()

From: Pranit Bauva <hidden>
Date: 2016-06-15 23:08:58

OPT_CMDMODE mechanism was introduced in the release of 1.8.5 to actively
notice when multiple "operation mode" options that specify mutually
incompatible operation modes are given.

Helped-by: Junio C Hamano [off-list ref]
Signed-off-by: Pranit Bauva <redacted>
---
 Documentation/technical/api-parse-options.txt | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 5f0757d..695bd4b 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -231,6 +231,13 @@ There are some macros to easily define options:
 	pass the command-line option, which can be specified multiple times,
 	to another command.
 
+`OPT_CMDMODE(short, long, &int_var, description, enum_val)`::
+	Define an "operation mode" option, only one of which in the same
+	group of "operating mode" options that share the same `int_var`
+	can be given by the user. `enum_val` is set to `int_var` when the
+	option is used, but an error is reported if other "operating mode"
+	option has already set its value to the same `int_var`.
+
 
 The last element of the array must be `OPT_END()`.
 

--
https://github.com/git/git/pull/219
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help