From 1b1dd23f2d6a707b7077cdf6bc6d4055bd0bfb7d Mon Sep 17 00:00:00 2001 From: Stephan Beyer Date: Sun, 13 Jul 2008 15:36:15 +0200 Subject: Make usage strings dash-less 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 Signed-off-by: Junio C Hamano diff --git a/builtin-add.c b/builtin-add.c index 9930cf5..bf13aa3 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -16,7 +16,7 @@ #include "parse-options.h" static const char * const builtin_add_usage[] = { - "git-add [options] [--] ...", + "git add [options] [--] ...", NULL }; static int patch_interactive = 0, add_interactive = 0; diff --git a/builtin-apply.c b/builtin-apply.c index d13313f..e15471b 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -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=] ..."; +"git apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=] ..."; static enum ws_error_action { nowarn_ws_error, diff --git a/builtin-archive.c b/builtin-archive.c index c2e0c1e..5cca460 100644 --- a/builtin-archive.c +++ b/builtin-archive.c @@ -13,7 +13,7 @@ #include "attr.h" static const char archive_usage[] = \ -"git-archive --format= [--prefix=/] [--verbose] [] [path...]"; +"git archive --format= [--prefix=/] [--verbose] [] [path...]"; static struct archiver_desc { diff --git a/builtin-blame.c b/builtin-blame.c index b451f6c..91850a5 100644 --- a/builtin-blame.c +++ b/builtin-blame.c @@ -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 ] [-M] [-C] [-C] [--contents ] [--incremental] [commit] [--] file\n" +"git blame [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [-L n,m] [-S ] [-M] [-C] [-C] [--contents ] [--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" diff --git a/builtin-branch.c b/builtin-branch.c index d279702..5cc3771 100644 --- a/builtin-branch.c +++ b/builtin-branch.c @@ -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] []", - "git-branch [options] [-r] (-d | -D) ", - "git-branch [options] (-m | -M) [] ", + "git branch [options] [-r | -a] [--merged | --no-merged]", + "git branch [options] [-l] [-f] []", + "git branch [options] [-r] (-d | -D) ", + "git branch [options] (-m | -M) [] ", NULL }; diff --git a/builtin-cat-file.c b/builtin-cat-file.c index 880e75a..7441a56 100644 --- a/builtin-cat-file.c +++ b/builtin-cat-file.c @@ -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|] ", - "git-cat-file [--batch|--batch-check] < ", + "git cat-file [-t|-s|-e|-p|] ", + "git cat-file [--batch|--batch-check] < ", NULL }; diff --git a/builtin-check-attr.c b/builtin-check-attr.c index 6afdfa1..cb783fc 100644 --- a/builtin-check-attr.c +++ b/builtin-check-attr.c @@ -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) { diff --git a/builtin-checkout-index.c b/builtin-checkout-index.c index eb1fc9a..71ebabf 100644 --- a/builtin-checkout-index.c +++ b/builtin-checkout-index.c @@ -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=] [--temp] [--] ..."; +"git checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=] [--temp] [--] ..."; static struct lock_file lock_file; diff --git a/builtin-clean.c b/builtin-clean.c index 80a7ff9..48bf29f 100644 --- a/builtin-clean.c +++ b/builtin-clean.c @@ -15,7 +15,7 @@ static int force = -1; /* unset */ static const char *const builtin_clean_usage[] = { - "git-clean [-d] [-f] [-n] [-q] [-x | -X] [--] ...", + "git clean [-d] [-f] [-n] [-q] [-x | -X] [--] ...", NULL }; diff --git a/builtin-clone.c b/builtin-clone.c index ec36209..8112716 100644 --- a/builtin-clone.c +++ b/builtin-clone.c @@ -29,7 +29,7 @@ * */ static const char * const builtin_clone_usage[] = { - "git-clone [options] [--] []", + "git clone [options] [--] []", NULL }; diff --git a/builtin-commit.c b/builtin-commit.c index 745c11e..41cf5f2 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -25,12 +25,12 @@ #include "unpack-trees.h" static const char * const builtin_commit_usage[] = { - "git-commit [options] [--] ...", + "git commit [options] [--] ...", NULL }; static const char * const builtin_status_usage[] = { - "git-status [options] [--] ...", + "git status [options] [--] ...", NULL }; diff --git a/builtin-config.c b/builtin-config.c index 39f63d7..0cf191a 100644 --- a/builtin-config.c +++ b/builtin-config.c @@ -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; diff --git a/builtin-count-objects.c b/builtin-count-objects.c index f00306f..91b5487 100644 --- a/builtin-count-objects.c +++ b/builtin-count-objects.c @@ -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 }; diff --git a/builtin-describe.c b/builtin-describe.c index e515f9c..5dabca9 100644 --- a/builtin-describe.c +++ b/builtin-describe.c @@ -10,7 +10,7 @@ #define MAX_TAGS (FLAG_BITS - 1) static const char * const describe_usage[] = { - "git-describe [options] *", + "git describe [options] *", NULL }; diff --git a/builtin-diff-files.c b/builtin-diff-files.c index 384d871..9bf10bb 100644 --- a/builtin-diff-files.c +++ b/builtin-diff-files.c @@ -10,7 +10,7 @@ #include "builtin.h" static const char diff_files_usage[] = -"git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [] [...]" +"git diff-files [-q] [-0/-1/2/3 |-c|--cc] [] [...]" COMMON_DIFF_OPTIONS_HELP; int cmd_diff_files(int argc, const char **argv, const char *prefix) diff --git a/builtin-diff-index.c b/builtin-diff-index.c index 2f44ebf..17d851b 100644 --- a/builtin-diff-index.c +++ b/builtin-diff-index.c @@ -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_HELP; diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c index 9d2a48f..415cb16 100644 --- a/builtin-diff-tree.c +++ b/builtin-diff-tree.c @@ -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] " "[] [] [...]\n" " -r diff recursively\n" " --root include the initial commit as diff against /dev/null\n" diff --git a/builtin-diff.c b/builtin-diff.c index 4c289e7..faaa85a 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -21,7 +21,7 @@ struct blobinfo { }; static const char builtin_diff_usage[] = -"git-diff {0,2} -- *"; +"git diff {0,2} -- *"; static void stuff_change(struct diff_options *opt, unsigned old_mode, unsigned new_mode, diff --git a/builtin-fast-export.c b/builtin-fast-export.c index 75132ba..76f3167 100644 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -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 }; diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index 1ea7040..273239a 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -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=] [--depth=] [--no-progress] [-v] [:] [...]"; +"git fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=] [--depth=] [--no-progress] [-v] [:] [...]"; #define COMPLETE (1U << 0) #define COMMON (1U << 1) diff --git a/builtin-fetch.c b/builtin-fetch.c index 97fdc51..61de50a 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -12,7 +12,7 @@ #include "parse-options.h" static const char * const builtin_fetch_usage[] = { - "git-fetch [options] [ ...]", + "git fetch [options] [ ...]", NULL }; diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c index b892621..b34b01f 100644 --- a/builtin-fmt-merge-msg.c +++ b/builtin-fmt-merge-msg.c @@ -6,7 +6,7 @@ #include "tag.h" static const char *fmt_merge_msg_usage = - "git-fmt-merge-msg [--log] [--no-log] [--file ]"; + "git fmt-merge-msg [--log] [--no-log] [--file ]"; static int merge_summary; diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c index fef93d7..76282ad 100644 --- a/builtin-for-each-ref.c +++ b/builtin-for-each-ref.c @@ -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] []", + "git for-each-ref [options] []", NULL }; diff --git a/builtin-fsck.c b/builtin-fsck.c index b0f9648..7326dc3 100644 --- a/builtin-fsck.c +++ b/builtin-fsck.c @@ -539,7 +539,7 @@ static int fsck_cache_tree(struct cache_tree *it) } static char const * const fsck_usage[] = { - "git-fsck [options] [...]", + "git fsck [options] [...]", NULL }; diff --git a/builtin-gc.c b/builtin-gc.c index f5625bb..fac200e 100644 --- a/builtin-gc.c +++ b/builtin-gc.c @@ -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 }; diff --git a/builtin-grep.c b/builtin-grep.c index ef29910..0cac395 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -495,7 +495,7 @@ static int grep_object(struct grep_opt *opt, const char **paths, } static const char builtin_grep_usage[] = -"git-grep