summaryrefslogtreecommitdiff
path: root/Documentation/technical/api-parse-options.txt
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-31 17:57:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-31 17:57:32 (GMT)
commit2d11f21c365821ccba1e093f22b99ad71b955f21 (patch)
tree1ecbe232f12904520838ab4adff6aa70d5ba6e80 /Documentation/technical/api-parse-options.txt
parent28b9264dd6cbadcef8b3e48c24ffcb2893b668b3 (diff)
parent5b42477b59886a85d4b49a60313f9b9d4a0d576f (diff)
downloadgit-2d11f21c365821ccba1e093f22b99ad71b955f21.zip
git-2d11f21c365821ccba1e093f22b99ad71b955f21.tar.gz
git-2d11f21c365821ccba1e093f22b99ad71b955f21.tar.bz2
Merge remote-tracking branch 'ko/maint' into jc/diff-index-quick-exit-early
* ko/maint: (4352 commits) git-submodule.sh: separate parens by a space to avoid confusing some shells Documentation/technical/api-diff.txt: correct name of diff_unmerge() read_gitfile_gently: use ssize_t to hold read result remove tests of always-false condition rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0' Git 1.7.5.3 init/clone: remove short option -L and document --separate-git-dir do not read beyond end of malloc'd buffer git-svn: Fix git svn log --show-commit Git 1.7.5.2 provide a copy of the LGPLv2.1 test core.gitproxy configuration copy_gecos: fix not adding nlen to len when processing "&" Update draft release notes to 1.7.5.2 Documentation/git-fsck.txt: fix typo: unreadable -> unreachable send-pack: avoid deadlock on git:// push with failed pack-objects connect: let callers know if connection is a socket connect: treat generic proxy processes like ssh processes sideband_demux(): fix decl-after-stmt t3503: test cherry picking and reverting root commits ... Conflicts: diff.c
Diffstat (limited to 'Documentation/technical/api-parse-options.txt')
-rw-r--r--Documentation/technical/api-parse-options.txt29
1 files changed, 22 insertions, 7 deletions
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 50f9e9a..f6a4a36 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -115,13 +115,19 @@ There are some macros to easily define options:
`OPT__ABBREV(&int_var)`::
Add `\--abbrev[=<n>]`.
-`OPT__DRY_RUN(&int_var)`::
+`OPT__COLOR(&int_var, description)`::
+ Add `\--color[=<when>]` and `--no-color`.
+
+`OPT__DRY_RUN(&int_var, description)`::
Add `-n, \--dry-run`.
-`OPT__QUIET(&int_var)`::
+`OPT__FORCE(&int_var, description)`::
+ Add `-f, \--force`.
+
+`OPT__QUIET(&int_var, description)`::
Add `-q, \--quiet`.
-`OPT__VERBOSE(&int_var)`::
+`OPT__VERBOSE(&int_var, description)`::
Add `-v, \--verbose`.
`OPT_GROUP(description)`::
@@ -183,13 +189,22 @@ There are some macros to easily define options:
arguments. Short options that happen to be digits take
precedence over it.
+`OPT_COLOR_FLAG(short, long, &int_var, description)`::
+ Introduce an option that takes an optional argument that can
+ have one of three values: "always", "never", or "auto". If the
+ argument is not given, it defaults to "always". The `--no-` form
+ works like `--long=never`; it cannot take an argument. If
+ "always", set `int_var` to 1; if "never", set `int_var` to 0; if
+ "auto", set `int_var` to 1 if stdout is a tty or a pager,
+ 0 otherwise.
+
The last element of the array must be `OPT_END()`.
If not stated otherwise, interpret the arguments as follows:
* `short` is a character for the short option
- (e.g. `\'e\'` for `-e`, use `0` to omit),
+ (e.g. `{apostrophe}e{apostrophe}` for `-e`, use `0` to omit),
* `long` is a string for the long option
(e.g. `"example"` for `\--example`, use `NULL` to omit),
@@ -216,10 +231,10 @@ The function must be defined in this form:
The callback mechanism is as follows:
* Inside `func`, the only interesting member of the structure
- given by `opt` is the void pointer `opt->value`.
- `\*opt->value` will be the value that is saved into `var`, if you
+ given by `opt` is the void pointer `opt\->value`.
+ `\*opt\->value` will be the value that is saved into `var`, if you
use `OPT_CALLBACK()`.
- For example, do `*(unsigned long *)opt->value = 42;` to get 42
+ For example, do `*(unsigned long *)opt\->value = 42;` to get 42
into an `unsigned long` variable.
* Return value `0` indicates success and non-zero return