Skip to content

Commit

Permalink
standardize usage info string format
Browse files Browse the repository at this point in the history
This patch puts the usage info strings that were not already in docopt-
like format into docopt-like format, which will be a litle easier for
end users and a lot easier for translators. Changes include:

- Placing angle brackets around fill-in-the-blank parameters
- Putting dashes in multiword parameter names
- Adding spaces to [-f|--foobar] to make [-f | --foobar]
- Replacing <foobar>* with [<foobar>...]

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alex Henrie authored and Junio C Hamano committed Jan 14, 2015
1 parent addfb21 commit 9c9b4f2
Show file tree
Hide file tree
Showing 64 changed files with 109 additions and 105 deletions.
8 changes: 6 additions & 2 deletions Documentation/CodingGuidelines
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ Writing Documentation:
--sort=<key>
--abbrev[=<n>]

If a placeholder has multiple words, they are separated by dashes:
<new-branch-name>
--template=<template-directory>

Possibility of multiple occurrences is indicated by three dots:
<file>...
(One or more of <file>.)
Expand All @@ -457,12 +461,12 @@ Writing Documentation:
(Zero or more of <patch>. Note that the dots are inside, not
outside the brackets.)

Multiple alternatives are indicated with vertical bar:
Multiple alternatives are indicated with vertical bars:
[-q | --quiet]
[--utf8 | --no-utf8]

Parentheses are used for grouping:
[(<rev>|<range>)...]
[(<rev> | <range>)...]
(Any number of either <rev> or <range>. Parens are needed to make
it clear that "..." pertains to both <rev> and <range>.)

Expand Down
2 changes: 1 addition & 1 deletion advice.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void detach_advice(const char *new_name)
"state without impacting any branches by performing another checkout.\n\n"
"If you want to create a new branch to retain commits you create, you may\n"
"do so (now or later) by using -b with the checkout command again. Example:\n\n"
" git checkout -b new_branch_name\n\n";
" git checkout -b <new-branch-name>\n\n";

fprintf(stderr, fmt, new_name);
}
4 changes: 2 additions & 2 deletions archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "dir.h"

static char const * const archive_usage[] = {
N_("git archive [options] <tree-ish> [<path>...]"),
N_("git archive [<options>] <tree-ish> [<path>...]"),
N_("git archive --list"),
N_("git archive --remote <repo> [--exec <cmd>] [options] <tree-ish> [<path>...]"),
N_("git archive --remote <repo> [--exec <cmd>] [<options>] <tree-ish> [<path>...]"),
N_("git archive --remote <repo> [--exec <cmd>] --list"),
NULL
};
Expand Down
2 changes: 1 addition & 1 deletion builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "argv-array.h"

static const char * const builtin_add_usage[] = {
N_("git add [options] [--] <pathspec>..."),
N_("git add [<options>] [--] <pathspec>..."),
NULL
};
static int patch_interactive, add_interactive, edit_interactive;
Expand Down
2 changes: 1 addition & 1 deletion builtin/apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static const char *fake_ancestor;
static int line_termination = '\n';
static unsigned int p_context = UINT_MAX;
static const char * const apply_usage[] = {
N_("git apply [options] [<patch>...]"),
N_("git apply [<options>] [<patch>...]"),
NULL
};

Expand Down
4 changes: 2 additions & 2 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
#include "line-range.h"
#include "line-log.h"

static char blame_usage[] = N_("git blame [options] [rev-opts] [rev] [--] file");
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] file");

static const char *blame_opt_usage[] = {
blame_usage,
"",
N_("[rev-opts] are documented in git-rev-list(1)"),
N_("<rev-opts> are documented in git-rev-list(1)"),
NULL
};

Expand Down
8 changes: 4 additions & 4 deletions builtin/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "wt-status.h"

static const char * const builtin_branch_usage[] = {
N_("git branch [options] [-r | -a] [--merged | --no-merged]"),
N_("git branch [options] [-l] [-f] <branchname> [<start-point>]"),
N_("git branch [options] [-r] (-d | -D) <branchname>..."),
N_("git branch [options] (-m | -M) [<oldbranch>] <newbranch>"),
N_("git branch [<options>] [-r | -a] [--merged | --no-merged]"),
N_("git branch [<options>] [-l] [-f] <branch-name> [<start-point>]"),
N_("git branch [<options>] [-r] (-d | -D) <branch-name>..."),
N_("git branch [<options>] (-m | -M) [<old-branch>] <new-branch>"),
NULL
};

Expand Down
4 changes: 2 additions & 2 deletions builtin/cat-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ static int batch_objects(struct batch_options *opt)
}

static const char * const cat_file_usage[] = {
N_("git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>"),
N_("git cat-file (--batch|--batch-check) < <list_of_objects>"),
N_("git cat-file (-t | -s | -e | -p | <type> | --textconv) <object>"),
N_("git cat-file (--batch | --batch-check) < <list-of-objects>"),
NULL
};

Expand Down
4 changes: 2 additions & 2 deletions builtin/check-attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ static int all_attrs;
static int cached_attrs;
static int stdin_paths;
static const char * const check_attr_usage[] = {
N_("git check-attr [-a | --all | attr...] [--] pathname..."),
N_("git check-attr --stdin [-z] [-a | --all | attr...] < <list-of-paths>"),
N_("git check-attr [-a | --all | <attr>...] [--] <pathname>..."),
N_("git check-attr --stdin [-z] [-a | --all | <attr>...] < <list-of-paths>"),
NULL
};

Expand Down
4 changes: 2 additions & 2 deletions builtin/check-ignore.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

static int quiet, verbose, stdin_paths, show_non_matching, no_index;
static const char * const check_ignore_usage[] = {
"git check-ignore [options] pathname...",
"git check-ignore [options] --stdin < <list-of-paths>",
"git check-ignore [<options>] <pathname>...",
"git check-ignore [<options>] --stdin < <list-of-paths>",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/check-mailmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

static int use_stdin;
static const char * const check_mailmap_usage[] = {
N_("git check-mailmap [options] <contact>..."),
N_("git check-mailmap [<options>] <contact>..."),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/check-ref-format.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "strbuf.h"

static const char builtin_check_ref_format_usage[] =
"git check-ref-format [--normalize] [options] <refname>\n"
"git check-ref-format [--normalize] [<options>] <refname>\n"
" or: git check-ref-format --branch <branchname-shorthand>";

/*
Expand Down
2 changes: 1 addition & 1 deletion builtin/checkout-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static void checkout_all(const char *prefix, int prefix_length)
}

static const char * const builtin_checkout_index_usage[] = {
N_("git checkout-index [options] [--] [<file>...]"),
N_("git checkout-index [<options>] [--] [<file>...]"),
NULL
};

Expand Down
8 changes: 4 additions & 4 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "argv-array.h"

static const char * const checkout_usage[] = {
N_("git checkout [options] <branch>"),
N_("git checkout [options] [<branch>] -- <file>..."),
N_("git checkout [<options>] <branch>"),
N_("git checkout [<options>] [<branch>] -- <file>..."),
NULL,
};

Expand Down Expand Up @@ -746,7 +746,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
_(
"If you want to keep them by creating a new branch, "
"this may be a good time\nto do so with:\n\n"
" git branch new_branch_name %s\n\n"),
" git branch <new-branch-name> %s\n\n"),
find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV));
}

Expand Down Expand Up @@ -1127,7 +1127,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
OPT_BOOL(0, "ignore-skip-worktree-bits", &opts.ignore_skipworktree,
N_("do not limit pathspecs to sparse entries only")),
OPT_HIDDEN_BOOL(0, "guess", &dwim_new_local_branch,
N_("second guess 'git checkout no-such-branch'")),
N_("second guess 'git checkout <no-such-branch>'")),
OPT_END(),
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*
*/
static const char * const builtin_clone_usage[] = {
N_("git clone [options] [--] <repo> [<dir>]"),
N_("git clone [<options>] [--] <repo> [<dir>]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/column.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "column.h"

static const char * const builtin_column_usage[] = {
N_("git column [options]"),
N_("git column [<options>]"),
NULL
};
static unsigned int colopts;
Expand Down
4 changes: 2 additions & 2 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
#include "mailmap.h"

static const char * const builtin_commit_usage[] = {
N_("git commit [options] [--] <pathspec>..."),
N_("git commit [<options>] [--] <pathspec>..."),
NULL
};

static const char * const builtin_status_usage[] = {
N_("git status [options] [--] <pathspec>..."),
N_("git status [<options>] [--] <pathspec>..."),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "urlmatch.h"

static const char *const builtin_config_usage[] = {
N_("git config [options]"),
N_("git config [<options>]"),
NULL
};

Expand Down
4 changes: 2 additions & 2 deletions builtin/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#define MAX_TAGS (FLAG_BITS - 1)

static const char * const describe_usage[] = {
N_("git describe [options] <commit-ish>*"),
N_("git describe [options] --dirty"),
N_("git describe [<options>] [<commit-ish>...]"),
N_("git describe [<options>] --dirty"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/diff-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "submodule.h"

static const char diff_files_usage[] =
"git diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
"git diff-files [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]"
COMMON_DIFF_OPTIONS_HELP;

int cmd_diff_files(int argc, const char **argv, const char *prefix)
Expand Down
2 changes: 1 addition & 1 deletion builtin/diff-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

static const char diff_cache_usage[] =
"git diff-index [-m] [--cached] "
"[<common diff options>] <tree-ish> [<path>...]"
"[<common-diff-options>] <tree-ish> [<path>...]"
COMMON_DIFF_OPTIONS_HELP;

int cmd_diff_index(int argc, const char **argv, const char *prefix)
Expand Down
2 changes: 1 addition & 1 deletion builtin/diff-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static int diff_tree_stdin(char *line)

static const char diff_tree_usage[] =
"git diff-tree [--stdin] [-m] [-c] [--cc] [-s] [-v] [--pretty] [-t] [-r] [--root] "
"[<common diff options>] <tree-ish> [<tree-ish>] [<path>...]\n"
"[<common-diff-options>] <tree-ish> [<tree-ish>] [<path>...]\n"
" -r diff recursively\n"
" --root include the initial commit as diff against /dev/null\n"
COMMON_DIFF_OPTIONS_HELP;
Expand Down
2 changes: 1 addition & 1 deletion builtin/fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "sha1-array.h"

static const char fetch_pack_usage[] =
"git fetch-pack [--all] [--stdin] [--quiet|-q] [--keep|-k] [--thin] "
"git fetch-pack [--all] [--stdin] [--quiet | -q] [--keep | -k] [--thin] "
"[--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] "
"[--no-progress] [--diag-url] [-v] [<host>:]<directory> [<refs>...]";

Expand Down
2 changes: 1 addition & 1 deletion builtin/fmt-merge-msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "gpg-interface.h"

static const char * const fmt_merge_msg_usage[] = {
N_("git fmt-merge-msg [-m <message>] [--log[=<n>]|--no-log] [--file <file>]"),
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/for-each-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ static int opt_parse_sort(const struct option *opt, const char *arg, int unset)
}

static char const * const for_each_ref_usage[] = {
N_("git for-each-ref [options] [<pattern>]"),
N_("git for-each-ref [<options>] [<pattern>]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/fsck.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static int fsck_cache_tree(struct cache_tree *it)
}

static char const * const fsck_usage[] = {
N_("git fsck [options] [<object>...]"),
N_("git fsck [<options>] [<object>...]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define FAILED_RUN "failed to run %s"

static const char * const builtin_gc_usage[] = {
N_("git gc [options]"),
N_("git gc [<options>]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "pathspec.h"

static char const * const grep_usage[] = {
N_("git grep [options] [-e] <pattern> [<rev>...] [[--] <path>...]"),
N_("git grep [<options>] [-e] <pattern> [<rev>...] [[--] <path>...]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/hash-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static void hash_stdin_paths(const char *type, int no_filters, unsigned flags,
int cmd_hash_object(int argc, const char **argv, const char *prefix)
{
static const char * const hash_object_usage[] = {
N_("git hash-object [-t <type>] [-w] [--path=<file>|--no-filters] [--stdin] [--] <file>..."),
N_("git hash-object [-t <type>] [-w] [--path=<file> | --no-filters] [--stdin] [--] <file>..."),
N_("git hash-object --stdin-paths < <list-of-paths>"),
NULL
};
Expand Down
2 changes: 1 addition & 1 deletion builtin/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static struct option builtin_help_options[] = {
};

static const char * const builtin_help_usage[] = {
N_("git help [--all] [--guides] [--man|--web|--info] [command]"),
N_("git help [--all] [--guides] [--man | --web | --info] [<command>]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ static int shared_callback(const struct option *opt, const char *arg, int unset)
}

static const char *const init_db_usage[] = {
N_("git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [directory]"),
N_("git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [<directory>]"),
NULL
};

Expand Down
6 changes: 3 additions & 3 deletions builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ static const char *fmt_patch_subject_prefix = "PATCH";
static const char *fmt_pretty;

static const char * const builtin_log_usage[] = {
N_("git log [<options>] [<revision range>] [[--] <path>...]\n")
N_(" or: git show [options] <object>..."),
N_("git log [<options>] [<revision-range>] [[--] <path>...]\n")
N_(" or: git show [<options>] <object>..."),
NULL
};

Expand Down Expand Up @@ -1023,7 +1023,7 @@ static const char *set_outdir(const char *prefix, const char *output_directory)
}

static const char * const builtin_format_patch_usage[] = {
N_("git format-patch [options] [<since> | <revision range>]"),
N_("git format-patch [<options>] [<since> | <revision-range>]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/ls-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ int report_path_error(const char *ps_matched,
}

static const char * const ls_files_usage[] = {
N_("git ls-files [options] [<file>...]"),
N_("git ls-files [<options>] [<file>...]"),
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin/ls-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

static const char ls_remote_usage[] =
"git ls-remote [--heads] [--tags] [-u <exec> | --upload-pack <exec>]\n"
" [-q|--quiet] [--exit-code] [--get-url] [<repository> [<refs>...]]";
" [-q | --quiet] [--exit-code] [--get-url] [<repository> [<refs>...]]";

/*
* Is there one among the list of patterns that match the tail part
Expand Down
2 changes: 1 addition & 1 deletion builtin/mailinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ static int git_mailinfo_config(const char *var, const char *value, void *unused)
}

static const char mailinfo_usage[] =
"git mailinfo [-k|-b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] msg patch < mail >info";
"git mailinfo [-k | -b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] <msg> <patch> < mail >info";

int cmd_mailinfo(int argc, const char **argv, const char *prefix)
{
Expand Down
Loading

0 comments on commit 9c9b4f2

Please sign in to comment.