<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/parse-options.h, branch v1.5.4.4</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.5.4.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v1.5.4.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2007-11-23T06:11:28Z</updated>
<entry>
<title>parse-options: Allow to hide options from the default usage.</title>
<updated>2007-11-23T06:11:28Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-11-19T09:21:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=dd3bf0f4a5bab17011e94bfeb808ee64dd2ad040'/>
<id>urn:sha1:dd3bf0f4a5bab17011e94bfeb808ee64dd2ad040</id>
<content type='text'>
This is useful for backward-compatibility aliases, or very advanced command
line switches introduced for internal git usages and have no real use for a
user.

parse-options still shows them if the user asks for --help-all.

Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options new features.</title>
<updated>2007-11-12T00:54:15Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-11-07T10:20:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=db7244bd5be12e389badb9cec621dbbcfa11f59a'/>
<id>urn:sha1:db7244bd5be12e389badb9cec621dbbcfa11f59a</id>
<content type='text'>
options flags:
~~~~~~~~~~~~~
  PARSE_OPT_NONEG allow the caller to disallow the negated option to exists.

option types:
~~~~~~~~~~~~
  OPTION_BIT: ORs (or NANDs) a mask.
  OPTION_SET_INT: force the value to be set to this integer.
  OPTION_SET_PTR: force the value to be set to this pointer.

helper:
~~~~~~
  HAS_MULTI_BITS (in git-compat-util.h) is a bit-hack to check if an
  unsigned integer has more than one bit set, useful to check if conflicting
  options have been used.

Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Some better parse-options documentation.</title>
<updated>2007-11-06T02:47:01Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-11-05T12:03:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=9b3beb581216fc89972e926574b9d3b243d5e4f4'/>
<id>urn:sha1:9b3beb581216fc89972e926574b9d3b243d5e4f4</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: allow callbacks to take no arguments at all.</title>
<updated>2007-10-30T04:03:31Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-10-15T22:32:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=f481e22a145ed17e85b68bf8ce2de4b80dfa4323'/>
<id>urn:sha1:f481e22a145ed17e85b68bf8ce2de4b80dfa4323</id>
<content type='text'>
Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>Add shortcuts for very often used options.</title>
<updated>2007-10-30T04:03:30Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-10-14T09:05:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=0ce865b134f8ccd60f6e584744144b0978a9fdf2'/>
<id>urn:sha1:0ce865b134f8ccd60f6e584744144b0978a9fdf2</id>
<content type='text'>
It helps with consistency of the help strings, for example.

Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>parse-options: make some arguments optional, add callbacks.</title>
<updated>2007-10-30T04:03:30Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-10-14T23:45:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=ffe659f94d793375fca97dd296422fc10c155016'/>
<id>urn:sha1:ffe659f94d793375fca97dd296422fc10c155016</id>
<content type='text'>
* add the possibility to use callbacks to parse some options, this can
  help implementing new options kinds with great flexibility. struct option
  gains a callback pointer and a `defval' where callbacks user can put
  either integers or pointers. callbacks also can use the `value' pointer
  for anything, preferably to the pointer to the final storage for the value
  though.

* add a `flag' member to struct option to make explicit that this option may
  have an optional argument. The semantics depends on the option type. For
  INTEGERS, it means that if the switch is not used in its
  --long-form=&lt;value&gt; form, and that there is no token after it or that the
  token does not starts with a digit, then it's assumed that the switch has
  no argument. For STRING or CALLBACK it works the same, except that the
  condition is that the next atom starts with a dash. This is needed to
  implement backward compatible behaviour with existing ways to parse the
  command line. Its use for new options is discouraged.

Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>parse-options: be able to generate usages automatically</title>
<updated>2007-10-30T04:03:30Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-10-14T23:38:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=d7a38c54a6ccbcbcf29d8cf1110b2702c8b3f7f8'/>
<id>urn:sha1:d7a38c54a6ccbcbcf29d8cf1110b2702c8b3f7f8</id>
<content type='text'>
Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
<entry>
<title>Add a simple option parser.</title>
<updated>2007-10-30T04:03:30Z</updated>
<author>
<name>Pierre Habouzit</name>
<email>madcoder@debian.org</email>
</author>
<published>2007-10-14T23:35:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=4a59fd131229968b08af9bdf221c341f54c52983'/>
<id>urn:sha1:4a59fd131229968b08af9bdf221c341f54c52983</id>
<content type='text'>
The option parser takes argc, argv, an array of struct option
and a usage string.  Each of the struct option elements in the array
describes a valid option, its type and a pointer to the location where the
value is written.  The entry point is parse_options(), which scans through
the given argv, and matches each option there against the list of valid
options.  During the scan, argv is rewritten to only contain the
non-option command line arguments and the number of these is returned.

Aggregation of single switches is allowed:
  -rC0 is the same as -r -C 0 (supposing that -C wants an arg).

Every long option automatically support the option with the same name,
prefixed with 'no-' to unset the switch. It assumes that initial value for
strings are "NULL" and for integers is "0".

Long options are supported either with '=' or without:
  --some-option=foo is the same as --some-option foo

Acked-by: Kristian Høgsberg &lt;krh@redhat.com&gt;
Signed-off-by: Pierre Habouzit &lt;madcoder@debian.org&gt;
Signed-off-by: Shawn O. Pearce &lt;spearce@spearce.org&gt;
</content>
</entry>
</feed>
