Skip to content

Commit

Permalink
Make usage strings dash-less
Browse files Browse the repository at this point in the history
When you misuse a git command, you are shown the usage string.
But this is currently shown in the dashed form.  So if you just
copy what you see, it will not work, when the dashed form
is no longer supported.

This patch makes git commands show the dash-less version.

For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
generates a dash-less usage string now.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
sbeyer authored and gitster committed Jul 13, 2008
1 parent d492b31 commit 1b1dd23
Show file tree
Hide file tree
Showing 80 changed files with 102 additions and 101 deletions.
2 changes: 1 addition & 1 deletion builtin-add.c
Expand Up @@ -16,7 +16,7 @@
#include "parse-options.h"

static const char * const builtin_add_usage[] = {
"git-add [options] [--] <filepattern>...",
"git add [options] [--] <filepattern>...",
NULL
};
static int patch_interactive = 0, add_interactive = 0;
Expand Down
2 changes: 1 addition & 1 deletion builtin-apply.c
Expand Up @@ -46,7 +46,7 @@ static const char *fake_ancestor;
static int line_termination = '\n';
static unsigned long p_context = ULONG_MAX;
static const char apply_usage[] =
"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|fix|error|error-all>] <patch>...";
"git apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|fix|error|error-all>] <patch>...";

static enum ws_error_action {
nowarn_ws_error,
Expand Down
2 changes: 1 addition & 1 deletion builtin-archive.c
Expand Up @@ -13,7 +13,7 @@
#include "attr.h"

static const char archive_usage[] = \
"git-archive --format=<fmt> [--prefix=<prefix>/] [--verbose] [<extra>] <tree-ish> [path...]";
"git archive --format=<fmt> [--prefix=<prefix>/] [--verbose] [<extra>] <tree-ish> [path...]";

static struct archiver_desc
{
Expand Down
2 changes: 1 addition & 1 deletion builtin-blame.c
Expand Up @@ -20,7 +20,7 @@
#include "mailmap.h"

static char blame_usage[] =
"git-blame [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [--contents <filename>] [--incremental] [commit] [--] file\n"
"git blame [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [-L n,m] [-S <revs-file>] [-M] [-C] [-C] [--contents <filename>] [--incremental] [commit] [--] file\n"
" -c Use the same output mode as git-annotate (Default: off)\n"
" -b Show blank SHA-1 for boundary commits (Default: off)\n"
" -l Show long commit SHA1 (Default: off)\n"
Expand Down
8 changes: 4 additions & 4 deletions builtin-branch.c
Expand Up @@ -15,10 +15,10 @@
#include "branch.h"

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

Expand Down
4 changes: 2 additions & 2 deletions builtin-cat-file.c
Expand Up @@ -202,8 +202,8 @@ static int batch_objects(int print_contents)
}

static const char * const cat_file_usage[] = {
"git-cat-file [-t|-s|-e|-p|<type>] <sha1>",
"git-cat-file [--batch|--batch-check] < <list_of_sha1s>",
"git cat-file [-t|-s|-e|-p|<type>] <sha1>",
"git cat-file [--batch|--batch-check] < <list_of_sha1s>",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-check-attr.c
Expand Up @@ -4,7 +4,7 @@
#include "quote.h"

static const char check_attr_usage[] =
"git-check-attr attr... [--] pathname...";
"git check-attr attr... [--] pathname...";

int cmd_check_attr(int argc, const char **argv, const char *prefix)
{
Expand Down
2 changes: 1 addition & 1 deletion builtin-checkout-index.c
Expand Up @@ -154,7 +154,7 @@ static void checkout_all(const char *prefix, int prefix_length)
}

static const char checkout_cache_usage[] =
"git-checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";
"git checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";

static struct lock_file lock_file;

Expand Down
2 changes: 1 addition & 1 deletion builtin-clean.c
Expand Up @@ -15,7 +15,7 @@
static int force = -1; /* unset */

static const char *const builtin_clean_usage[] = {
"git-clean [-d] [-f] [-n] [-q] [-x | -X] [--] <paths>...",
"git clean [-d] [-f] [-n] [-q] [-x | -X] [--] <paths>...",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-clone.c
Expand Up @@ -29,7 +29,7 @@
*
*/
static const char * const builtin_clone_usage[] = {
"git-clone [options] [--] <repo> [<dir>]",
"git clone [options] [--] <repo> [<dir>]",
NULL
};

Expand Down
4 changes: 2 additions & 2 deletions builtin-commit.c
Expand Up @@ -25,12 +25,12 @@
#include "unpack-trees.h"

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

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

Expand Down
2 changes: 1 addition & 1 deletion builtin-config.c
Expand Up @@ -3,7 +3,7 @@
#include "color.h"

static const char git_config_set_usage[] =
"git-config [ --global | --system | [ -f | --file ] config-file ] [ --bool | --int | --bool-or-int ] [ -z | --null ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list | --get-color var [default] | --get-colorbool name [stdout-is-tty]";
"git config [ --global | --system | [ -f | --file ] config-file ] [ --bool | --int | --bool-or-int ] [ -z | --null ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --remove-section name | --list | --get-color var [default] | --get-colorbool name [stdout-is-tty]";

static char *key;
static regex_t *key_regexp;
Expand Down
2 changes: 1 addition & 1 deletion builtin-count-objects.c
Expand Up @@ -67,7 +67,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
}

static char const * const count_objects_usage[] = {
"git-count-objects [-v]",
"git count-objects [-v]",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-describe.c
Expand Up @@ -10,7 +10,7 @@
#define MAX_TAGS (FLAG_BITS - 1)

static const char * const describe_usage[] = {
"git-describe [options] <committish>*",
"git describe [options] <committish>*",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-diff-files.c
Expand Up @@ -10,7 +10,7 @@
#include "builtin.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
Expand Up @@ -5,7 +5,7 @@
#include "builtin.h"

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

Expand Down
2 changes: 1 addition & 1 deletion builtin-diff-tree.c
Expand Up @@ -53,7 +53,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] "
"git diff-tree [--stdin] [-m] [-c] [--cc] [-s] [-v] [--pretty] [-t] [-r] [--root] "
"[<common diff options>] <tree-ish> [<tree-ish>] [<path>...]\n"
" -r diff recursively\n"
" --root include the initial commit as diff against /dev/null\n"
Expand Down
2 changes: 1 addition & 1 deletion builtin-diff.c
Expand Up @@ -21,7 +21,7 @@ struct blobinfo {
};

static const char builtin_diff_usage[] =
"git-diff <options> <rev>{0,2} -- <path>*";
"git diff <options> <rev>{0,2} -- <path>*";

static void stuff_change(struct diff_options *opt,
unsigned old_mode, unsigned new_mode,
Expand Down
2 changes: 1 addition & 1 deletion builtin-fast-export.c
Expand Up @@ -18,7 +18,7 @@
#include "parse-options.h"

static const char *fast_export_usage[] = {
"git-fast-export [rev-list-opts]",
"git fast-export [rev-list-opts]",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-fetch-pack.c
Expand Up @@ -18,7 +18,7 @@ static struct fetch_pack_args args = {
};

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

#define COMPLETE (1U << 0)
#define COMMON (1U << 1)
Expand Down
2 changes: 1 addition & 1 deletion builtin-fetch.c
Expand Up @@ -12,7 +12,7 @@
#include "parse-options.h"

static const char * const builtin_fetch_usage[] = {
"git-fetch [options] [<repository> <refspec>...]",
"git fetch [options] [<repository> <refspec>...]",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-fmt-merge-msg.c
Expand Up @@ -6,7 +6,7 @@
#include "tag.h"

static const char *fmt_merge_msg_usage =
"git-fmt-merge-msg [--log] [--no-log] [--file <file>]";
"git fmt-merge-msg [--log] [--no-log] [--file <file>]";

static int merge_summary;

Expand Down
2 changes: 1 addition & 1 deletion builtin-for-each-ref.c
Expand Up @@ -831,7 +831,7 @@ int opt_parse_sort(const struct option *opt, const char *arg, int unset)
}

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

Expand Down
2 changes: 1 addition & 1 deletion builtin-fsck.c
Expand Up @@ -539,7 +539,7 @@ static int fsck_cache_tree(struct cache_tree *it)
}

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

Expand Down
2 changes: 1 addition & 1 deletion builtin-gc.c
Expand Up @@ -18,7 +18,7 @@
#define FAILED_RUN "failed to run %s"

static const char * const builtin_gc_usage[] = {
"git-gc [options]",
"git gc [options]",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-grep.c
Expand Up @@ -495,7 +495,7 @@ static int grep_object(struct grep_opt *opt, const char **paths,
}

static const char builtin_grep_usage[] =
"git-grep <option>* <rev>* [-e] <pattern> [<path>...]";
"git grep <option>* <rev>* [-e] <pattern> [<path>...]";

static const char emsg_invalid_context_len[] =
"%s: invalid context length argument";
Expand Down
2 changes: 1 addition & 1 deletion builtin-init-db.c
Expand Up @@ -364,7 +364,7 @@ static int guess_repository_type(const char *git_dir)
}

static const char init_db_usage[] =
"git-init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]]";
"git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]]";

/*
* If you want to, you can share the DB area with any number of branches.
Expand Down
2 changes: 1 addition & 1 deletion builtin-log.c
Expand Up @@ -1082,7 +1082,7 @@ static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)
}

static const char cherry_usage[] =
"git-cherry [-v] <upstream> [<head>] [<limit>]";
"git cherry [-v] <upstream> [<head>] [<limit>]";
int cmd_cherry(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
Expand Down
2 changes: 1 addition & 1 deletion builtin-ls-files.c
Expand Up @@ -423,7 +423,7 @@ int report_path_error(const char *ps_matched, const char **pathspec, int prefix_
}

static const char ls_files_usage[] =
"git-ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
"git ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
"[ --ignored ] [--exclude=<pattern>] [--exclude-from=<file>] "
"[ --exclude-per-directory=<filename> ] [--exclude-standard] "
"[--full-name] [--abbrev] [--] [<file>]*";
Expand Down
2 changes: 1 addition & 1 deletion builtin-ls-remote.c
Expand Up @@ -4,7 +4,7 @@
#include "remote.h"

static const char ls_remote_usage[] =
"git-ls-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
"git ls-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";

/*
* Is there one among the list of patterns that match the tail part
Expand Down
2 changes: 1 addition & 1 deletion builtin-ls-tree.c
Expand Up @@ -23,7 +23,7 @@ static int chomp_prefix;
static const char *ls_tree_prefix;

static const char ls_tree_usage[] =
"git-ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] <tree-ish> [path...]";
"git ls-tree [-d] [-r] [-t] [-l] [-z] [--name-only] [--name-status] [--full-name] [--abbrev[=<n>]] <tree-ish> [path...]";

static int show_recursive(const char *base, int baselen, const char *pathname)
{
Expand Down
2 changes: 1 addition & 1 deletion builtin-mailinfo.c
Expand Up @@ -960,7 +960,7 @@ static int mailinfo(FILE *in, FILE *out, int ks, const char *encoding,
}

static const char mailinfo_usage[] =
"git-mailinfo [-k] [-u | --encoding=<encoding>] msg patch <mail >info";
"git mailinfo [-k] [-u | --encoding=<encoding>] msg patch <mail >info";

int cmd_mailinfo(int argc, const char **argv, const char *prefix)
{
Expand Down
2 changes: 1 addition & 1 deletion builtin-mailsplit.c
Expand Up @@ -9,7 +9,7 @@
#include "path-list.h"

static const char git_mailsplit_usage[] =
"git-mailsplit [-d<prec>] [-f<n>] [-b] -o<directory> <mbox>|<Maildir>...";
"git mailsplit [-d<prec>] [-f<n>] [-b] -o<directory> <mbox>|<Maildir>...";

static int is_from_line(const char *line, int len)
{
Expand Down
2 changes: 1 addition & 1 deletion builtin-merge-base.c
Expand Up @@ -20,7 +20,7 @@ static int show_merge_base(struct commit *rev1, struct commit *rev2, int show_al
}

static const char merge_base_usage[] =
"git-merge-base [--all] <commit-id> <commit-id>";
"git merge-base [--all] <commit-id> <commit-id>";

int cmd_merge_base(int argc, const char **argv, const char *prefix)
{
Expand Down
2 changes: 1 addition & 1 deletion builtin-mv.c
Expand Up @@ -11,7 +11,7 @@
#include "parse-options.h"

static const char * const builtin_mv_usage[] = {
"git-mv [options] <source>... <destination>",
"git mv [options] <source>... <destination>",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-name-rev.c
Expand Up @@ -172,7 +172,7 @@ static void show_name(const struct object *obj,
}

static char const * const name_rev_usage[] = {
"git-name-rev [options] ( --all | --stdin | <commit>... )",
"git name-rev [options] ( --all | --stdin | <commit>... )",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-pack-refs.c
Expand Up @@ -3,7 +3,7 @@
#include "pack-refs.h"

static char const * const pack_refs_usage[] = {
"git-pack-refs [options]",
"git pack-refs [options]",
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion builtin-prune-packed.c
Expand Up @@ -3,7 +3,7 @@
#include "progress.h"

static const char prune_packed_usage[] =
"git-prune-packed [-n] [-q]";
"git prune-packed [-n] [-q]";

#define DRY_RUN 01
#define VERBOSE 02
Expand Down
2 changes: 1 addition & 1 deletion builtin-prune.c
Expand Up @@ -7,7 +7,7 @@
#include "parse-options.h"

static const char * const prune_usage[] = {
"git-prune [-n] [--expire <time>] [--] [<head>...]",
"git prune [-n] [--expire <time>] [--] [<head>...]",
NULL
};
static int show_only;
Expand Down
2 changes: 1 addition & 1 deletion builtin-push.c
Expand Up @@ -10,7 +10,7 @@
#include "parse-options.h"

static const char * const push_usage[] = {
"git-push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
"git push [--all | --mirror] [--dry-run] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]",
NULL,
};

Expand Down
6 changes: 3 additions & 3 deletions builtin-reflog.c
Expand Up @@ -13,9 +13,9 @@
*/

static const char reflog_expire_usage[] =
"git-reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
"git reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...";
static const char reflog_delete_usage[] =
"git-reflog delete [--verbose] [--dry-run] [--rewrite] [--updateref] <refs>...";
"git reflog delete [--verbose] [--dry-run] [--rewrite] [--updateref] <refs>...";

static unsigned long default_reflog_expire;
static unsigned long default_reflog_expire_unreachable;
Expand Down Expand Up @@ -630,7 +630,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
*/

static const char reflog_usage[] =
"git-reflog (expire | ...)";
"git reflog (expire | ...)";

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

0 comments on commit 1b1dd23

Please sign in to comment.