[PATCH] Documentation: add a script to generate a (long/short) options overview

2013-10-31 Thread Stefan Beller
Recently a discussion started on the mailing list, which short option
shall be best for a long option. (-f being always --force and therefore
should not be reassigned another meaning in one particular command)
See http://www.mail-archive.com/git@vger.kernel.org/msg38456.html

For discussions as these we need a script to easily generate an
overview of all available one letter options, and their long option
equivalents.

As the list of options was not retrieved fully automated,
there might be minor errors or missing items.

Signed-off-by: Stefan Beller stefanbel...@googlemail.com
---
 Documentation/generateShortOptions.py | 460 ++
 1 file changed, 460 insertions(+)
 create mode 100644 Documentation/generateShortOptions.py

diff --git a/Documentation/generateShortOptions.py 
b/Documentation/generateShortOptions.py
new file mode 100644
index 000..1d326f9
--- /dev/null
+++ b/Documentation/generateShortOptions.py
@@ -0,0 +1,460 @@
+#!/usr/bin/python
+# This script generates a table, which should help you getting a
+# better overview of the existing long and short options of the
+# various git commands. This script actually is only suited for
+# generating the table itself, as the collection of the options of
+# the git commands needs to be done manually.
+# For the majority of commands, which are written in C, a small patch
+# such as the following helps to extract the relevant cases for this
+# script. However you still need to go through the shell commands
+# manually.
+# diff --git a/parse-options.c b/parse-options.c
+# index 62e9b1c..b356ca9 100644
+# --- a/parse-options.c
+# +++ b/parse-options.c
+# @@ -500,6 +500,12 @@ int parse_options(int argc, const char **argv, const 
char *prefix,
+#  {
+#  struct parse_opt_ctx_t ctx;
+#
+# +for (; options-type != OPTION_END; options++) {
+# +if (options-long_name  options-short_name)
+# +printf(%s,  %c, %s\n, argv[0], options-short_name, 
options-long_name);
+# +}
+# +exit(1);
+# +
+#  parse_options_start(ctx, argc, argv, prefix, options, flags);
+#  switch (parse_options_step(ctx, options, usagestr)) {
+#  case PARSE_OPT_HELP:
+# --
+
+
+# Command, short option, long option
+cmd_results=add,  n, dry-run
+add,  v, verbose
+add,  i, interactive
+add,  p, patch
+add,  e, edit
+add,  f, force
+add,  u, update
+add,  N, intent-to-add
+add,  A, all
+
+am, i, interactive
+am, 3, 3way
+am, q, quiet
+am, s, signoff
+am, u, utf8
+am, k, keep
+
+annotate, p, porcelain
+
+apply,  3, 3way
+apply,  R, reverse
+apply,  v, verbose
+
+archive,  o, output
+
+blame, p, porcelain
+blame, f, show-name
+blame, n, show-number
+blame, e, show-email
+
+branch,  v, verbose
+branch,  q, quiet
+branch,  t, track
+branch,  u, set-upstream-to
+branch,  r, remotes
+branch,  a, all
+branch,  d, delete
+branch,  m, move
+branch,  l, create-reflog
+branch,  f, force
+
+check-attr,  a, all
+
+check-ignore,  q, quiet
+check-ignore,  v, verbose
+check-ignore,  n, non-matching
+
+checkout,  q, quiet
+checkout,  t, track
+checkout,  2, ours
+checkout,  3, theirs
+checkout,  f, force
+checkout,  m, merge
+checkout,  p, patch
+
+checkout-index,  a, all
+checkout-index,  f, force
+checkout-index,  q, quiet
+checkout-index,  n, no-create
+checkout-index,  u, index
+
+cherry,  v, verbose
+
+cherry-pick,  n, no-commit
+cherry-pick,  e, edit
+cherry-pick,  s, signoff
+cherry-pick,  m, mainline
+cherry-pick,  X, strategy-option
+
+clean,  q, quiet
+clean,  n, dry-run
+clean,  f, force
+clean,  i, interactive
+clean,  e, exclude
+
+clone,  v, verbose
+clone,  q, quiet
+clone,  n, no-checkout
+clone,  l, local
+clone,  s, shared
+clone,  o, origin
+clone,  b, branch
+clone,  u, upload-pack
+clone,  c, config
+
+commit,  q, quiet
+commit,  v, verbose
+commit,  F, file
+commit,  m, message
+commit,  c, reedit-message
+commit,  C, reuse-message
+commit,  s, signoff
+commit,  t, template
+commit,  e, edit
+commit,  S, gpg-sign
+commit,  a, all
+commit,  i, include
+commit,  p, patch
+commit,  o, only
+commit,  n, no-verify
+commit,  z, null
+commit,  u, untracked-files
+
+config,  f, file
+config,  l, list
+config,  e, edit
+config,  z, null
+
+count-objects,  v, verbose
+count-objects,  H, human-readable
+
+diff, u, patch
+diff, p, patch
+diff, U, unified
+diff, B, break-rewrites
+diff, M, find-renames
+diff, C, find-copies
+diff, D, irreversible-delete
+diff, a, text
+diff, b, ignore-space-change
+diff, w, ignore-all-space
+diff, W, function-context
+
+diff-files, u, patch
+diff-files, p, patch
+diff-files, U, unified
+diff-files, B, break-rewrites
+diff-files, M, find-renames
+diff-files, C, find-copies
+diff-files, D, irreversible-delete
+diff-files, a, text
+diff-files, b, ignore-space-change
+diff-files, w, ignore-all-space
+diff-files, W, function-context
+diff-files, c, cc
+# diff-index and diff-tree similar, to be done
+
+fetch,  v, verbose
+fetch,  q, quiet
+fetch,  a, append
+fetch,  f, force
+fetch,  m, 

Re: [PATCH] Documentation: add a script to generate a (long/short) options overview

2013-10-31 Thread brian m. carlson
On Fri, Nov 01, 2013 at 12:09:10AM +0100, Stefan Beller wrote:
 On 11/01/2013 12:04 AM, Stefan Beller wrote:
  Recently a discussion started on the mailing list, which short option
  shall be best for a long option. (-f being always --force and therefore
  should not be reassigned another meaning in one particular command)
  See http://www.mail-archive.com/git@vger.kernel.org/msg38456.html
  
  For discussions as these we need a script to easily generate an
  overview of all available one letter options, and their long option
  equivalents.
  
  As the list of options was not retrieved fully automated,
  there might be minor errors or missing items.
  
  Signed-off-by: Stefan Beller stefanbel...@googlemail.com
  ---
   Documentation/generateShortOptions.py | 460 
  ++
   1 file changed, 460 insertions(+)
   create mode 100644 Documentation/generateShortOptions.py
  
 
 When trying to send a follow-up patch with the table itself, I got:
 fatal: 
 /tmp/wHpJlnf1r5/0002-Documentation-add-table-viewing-short-long-options-f.patch:
  19: patch contains a line longer than 998 characters
 warning: no patches were sent
 
 Is this an artifical limitation or something that actually makes sense?

RFC 5321 forbids lines exceeding 1000 octets (including CRLF).  RFC 5322
forbids lines exceeding 998 characters (excluding CRLF).  If you want to
get around that, you need to base64-encode the content, which is
generally discouraged when sending patches, I believe.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187


signature.asc
Description: Digital signature


Re: [PATCH] Documentation: add a script to generate a (long/short) options overview

2013-10-31 Thread Junio C Hamano
brian m. carlson sand...@crustytoothpaste.net writes:

 RFC 5321 forbids lines exceeding 1000 octets (including CRLF).  RFC 5322
 forbids lines exceeding 998 characters (excluding CRLF).  If you want to
 get around that, you need to base64-encode the content, which is
 generally discouraged when sending patches, I believe.

All true.

A message like the one posted before and got a positive wow, good
work, is a good thinkg to motivate somebody to work on bringing the
codebase and build procedure to aspire for producing that table from
within the build procedure; I do not think this information fixed in
time belongs to the source tree (iow, making it into a patch form is
of no use).  It will go stale over time without a way to automate
the synchronization somehow.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html