1 | /* |
---|
2 | * help-cmd.c -- Provide help |
---|
3 | * |
---|
4 | * ==================================================================== |
---|
5 | * Copyright (c) 2000-2004 CollabNet. All rights reserved. |
---|
6 | * |
---|
7 | * This software is licensed as described in the file COPYING, which |
---|
8 | * you should have received as part of this distribution. The terms |
---|
9 | * are also available at http://subversion.tigris.org/license-1.html. |
---|
10 | * If newer versions of this license are posted there, you may use a |
---|
11 | * newer version instead, at your option. |
---|
12 | * |
---|
13 | * This software consists of voluntary contributions made by many |
---|
14 | * individuals. For exact contribution history, see the revision |
---|
15 | * history and logs, available at http://subversion.tigris.org/. |
---|
16 | * ==================================================================== |
---|
17 | */ |
---|
18 | |
---|
19 | /* ==================================================================== */ |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | /*** Includes. ***/ |
---|
24 | |
---|
25 | #include "svn_string.h" |
---|
26 | #include "svn_error.h" |
---|
27 | #include "svn_version.h" |
---|
28 | #include "cl.h" |
---|
29 | |
---|
30 | #include "svn_private_config.h" |
---|
31 | |
---|
32 | |
---|
33 | /*** Code. ***/ |
---|
34 | |
---|
35 | /* This implements the `svn_opt_subcommand_t' interface. */ |
---|
36 | svn_error_t * |
---|
37 | svn_cl__help(apr_getopt_t *os, |
---|
38 | void *baton, |
---|
39 | apr_pool_t *pool) |
---|
40 | { |
---|
41 | svn_cl__opt_state_t *opt_state; |
---|
42 | |
---|
43 | /* xgettext: the %s is for SVN_VER_NUMBER. */ |
---|
44 | char help_header_template[] = |
---|
45 | N_("usage: svn <subcommand> [options] [args]\n" |
---|
46 | "Subversion command-line client, version %s.\n" |
---|
47 | "Type 'svn help <subcommand>' for help on a specific subcommand.\n" |
---|
48 | "Type 'svn --version' to see the program version and RA modules\n" |
---|
49 | " or 'svn --version --quiet' to see just the version number.\n" |
---|
50 | "\n" |
---|
51 | "Most subcommands take file and/or directory arguments, recursing\n" |
---|
52 | "on the directories. If no arguments are supplied to such a\n" |
---|
53 | "command, it recurses on the current directory (inclusive) by default.\n" |
---|
54 | "\n" |
---|
55 | "Available subcommands:\n"); |
---|
56 | |
---|
57 | char help_footer[] = |
---|
58 | N_("Subversion is a tool for version control.\n" |
---|
59 | "For additional information, see http://subversion.tigris.org/\n"); |
---|
60 | |
---|
61 | char *help_header = |
---|
62 | apr_psprintf(pool, _(help_header_template), SVN_VER_NUMBER); |
---|
63 | |
---|
64 | const char *ra_desc_start |
---|
65 | = _("The following repository access (RA) modules are available:\n\n"); |
---|
66 | |
---|
67 | svn_stringbuf_t *version_footer; |
---|
68 | |
---|
69 | if (baton) |
---|
70 | opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state; |
---|
71 | else |
---|
72 | opt_state = NULL; |
---|
73 | |
---|
74 | version_footer = svn_stringbuf_create(ra_desc_start, pool); |
---|
75 | SVN_ERR(svn_ra_print_modules(version_footer, pool)); |
---|
76 | |
---|
77 | return svn_opt_print_help3(os, |
---|
78 | "svn", /* ### erm, derive somehow? */ |
---|
79 | opt_state ? opt_state->version : FALSE, |
---|
80 | opt_state ? opt_state->quiet : FALSE, |
---|
81 | version_footer->data, |
---|
82 | help_header, /* already gettext()'d */ |
---|
83 | svn_cl__cmd_table, |
---|
84 | svn_cl__options, |
---|
85 | svn_cl__global_options, |
---|
86 | _(help_footer), |
---|
87 | pool); |
---|
88 | } |
---|