You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/10/25 14:10:37 UTC

svn commit: r1027081 - in /subversion/trunk/subversion: libsvn_subr/opt.c tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout

Author: julianfoad
Date: Mon Oct 25 12:10:37 2010
New Revision: 1027081

URL: http://svn.apache.org/viewvc?rev=1027081&view=rev
Log:
Print long aliases of command-line options in the same style as we already
print the long name as an alias for the short name.  This makes the help
text shorter and more consistent.

* subversion/libsvn_subr/opt.c
  (format_option): Print both kinds of alias in the same style.

* subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout
  Adjust the expected help output.

Modified:
    subversion/trunk/subversion/libsvn_subr/opt.c
    subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout

Modified: subversion/trunk/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1027081&r1=1027080&r2=1027081&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/opt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/opt.c Mon Oct 25 12:10:37 2010
@@ -178,6 +178,8 @@ format_option(const char **string,
      name" (a single-character alias for the long option). */
   if (opt->optch <= 255)
     opts = apr_psprintf(pool, "-%c [--%s]", opt->optch, opt->name);
+  else if (long_alias)
+    opts = apr_psprintf(pool, "--%s [--%s]", opt->name, long_alias);
   else
     opts = apr_psprintf(pool, "--%s", opt->name);
 
@@ -185,13 +187,7 @@ format_option(const char **string,
     opts = apr_pstrcat(pool, opts, _(" ARG"), (char *)NULL);
 
   if (doc)
-    {
-      opts = apr_psprintf(pool, "%-24s : %s", opts, _(opt->description));
-      if (long_alias)
-        opts = apr_pstrcat(pool, opts,
-                           "\n                             [alias: --",
-                           long_alias, "]", (char *)NULL);
-    }
+    opts = apr_psprintf(pool, "%-24s : %s", opts, _(opt->description));
 
   *string = opts;
 }

Modified: subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout?rev=1027081&r1=1027080&r2=1027081&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout (original)
+++ subversion/trunk/subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout Mon Oct 25 12:10:37 2010
@@ -50,19 +50,16 @@ Valid options:
                              history
   -c [--change] ARG        : the change made in revision ARG
   --targets ARG            : pass contents of file ARG as additional args
-  --stop-on-copy           : do not cross copies while traversing history
-                             [alias: --soc]
+  --stop-on-copy [--soc]   : do not cross copies while traversing history
   --incremental            : give output suitable for concatenation
   --xml                    : output in XML
   -l [--limit] ARG         : maximum number of log entries
   --with-all-revprops      : retrieve all revision properties
   --with-no-revprops       : retrieve no revision properties
   --with-revprop ARG       : retrieve revision property ARG
-  --show-diff              : produce diff output
-                             [alias: --diff]
+  --show-diff [--diff]     : produce diff output
   --diff-cmd ARG           : use ARG as diff command
-  --internal-diff          : override diff-cmd specified in config file
-                             [alias: --idiff]
+  --internal-diff [--idiff] : override diff-cmd specified in config file
   -x [--extensions] ARG    : Default: '-u'. When Subversion is invoking an
                              external diff program, ARG is simply passed along
                              to the program. But when Subversion is using its
@@ -83,13 +80,11 @@ Valid options:
 Global options:
   --username ARG           : specify a username ARG
   --password ARG           : specify a password ARG
-  --no-auth-cache          : do not cache authentication tokens
-                             [alias: --nac]
+  --no-auth-cache [--nac]  : do not cache authentication tokens
   --non-interactive        : do no interactive prompting
   --trust-server-cert      : accept unknown SSL server certificates without
                              prompting (but only with '--non-interactive')
-  --config-dir ARG         : read user configuration files from directory ARG
-                             [alias: --cd]
+  --config-dir [--cd] ARG  : read user configuration files from directory ARG
   --config-option ARG      : set user configuration option in the format:
                                  FILE:SECTION:OPTION=[VALUE]
                              For example:
@@ -143,14 +138,12 @@ Valid options:
   -N [--non-recursive]     : obsolete; try --depth=files or --depth=immediates
   --depth ARG              : limit operation by depth ARG ('empty', 'files',
                              'immediates', or 'infinity')
-  --set-depth ARG          : set new working copy depth to ARG ('exclude',
+  --set-depth [--sd] ARG   : set new working copy depth to ARG ('exclude',
                              'empty', 'files', 'immediates', or 'infinity')
-                             [alias: --sd]
   -q [--quiet]             : print nothing, or only summary information
   --diff3-cmd ARG          : use ARG as merge command
   --relocate               : relocate via URL-rewriting
-  --ignore-externals       : ignore externals definitions
-                             [alias: --ie]
+  --ignore-externals [--ie] : ignore externals definitions
   --force                  : force operation to run
   --accept ARG             : specify automatic conflict resolution action
                              ('postpone', 'base', 'mine-conflict',
@@ -160,13 +153,11 @@ Valid options:
 Global options:
   --username ARG           : specify a username ARG
   --password ARG           : specify a password ARG
-  --no-auth-cache          : do not cache authentication tokens
-                             [alias: --nac]
+  --no-auth-cache [--nac]  : do not cache authentication tokens
   --non-interactive        : do no interactive prompting
   --trust-server-cert      : accept unknown SSL server certificates without
                              prompting (but only with '--non-interactive')
-  --config-dir ARG         : read user configuration files from directory ARG
-                             [alias: --cd]
+  --config-dir [--cd] ARG  : read user configuration files from directory ARG
   --config-option ARG      : set user configuration option in the format:
                                  FILE:SECTION:OPTION=[VALUE]
                              For example: