Mercurial Queues Emulation for Git
修訂 | 0f1512b20bf0bdbe6ecd29b2fc5707095b22c8b7 (tree) |
---|---|
時間 | 2022-02-23 01:43:02 |
作者 | Keith Marshall <keith@user...> |
Commiter | Keith Marshall |
Robustly interpret "--color" and "--colour" as aliases.
* git-mq-setup.sh (git_mq_getopt): Explicitly match...
(--colour, --no-colour): ...either of these options, rather than...
(--c*, "-]", --no-c*): ...any of these.
* git-mq-setup.shar.in: Before loading...
(git-sh-setup): ...this helper script, scan and rewrite...
($@): ...this list of command line arguments; for any matching...
(--color*): ...this, insert "u" before "r"; also replace...
(--no-color): ...this, with...
(--no-colour): ...this.
@@ -10,7 +10,7 @@ | ||
10 | 10 | # $Id$ |
11 | 11 | # |
12 | 12 | # Written by Keith Marshall <keith@users.osdn.me> |
13 | -# Copyright (C) 2018, Keith Marshall | |
13 | +# Copyright (C) 2018, 2022, Keith Marshall | |
14 | 14 | # |
15 | 15 | # This file is part of the Git-MQ program suite. |
16 | 16 | # |
@@ -59,8 +59,8 @@ | ||
59 | 59 | if test "x$mq_optarg" = x |
60 | 60 | then case $1 in |
61 | 61 | -*) case $1 in |
62 | - --no-c*) mq_colour=never ;; | |
63 | - "-]" | --c*) mq_enable_colour "${2-always}" ;; | |
62 | + --no-colour) mq_colour=never ;; | |
63 | + --colour) mq_enable_colour "${2-always}" ;; | |
64 | 64 | esac; true ;; |
65 | 65 | *) false ;; |
66 | 66 | esac |
@@ -14,7 +14,7 @@ cat <<\ETX | ||
14 | 14 | # $Id$ |
15 | 15 | # |
16 | 16 | # Written by Keith Marshall <keith@users.osdn.me> |
17 | -# Copyright (C) 2018-2020, Keith Marshall | |
17 | +# Copyright (C) 2018-2020, 2022, Keith Marshall | |
18 | 18 | # |
19 | 19 | # |
20 | 20 | # This file is part of the Git-MQ program suite. |
@@ -45,17 +45,24 @@ v,verbose!* generic verbosity selector -- may have no effect" | ||
45 | 45 | |
46 | 46 | # For Git-MQ options, such as "--colour", we prefer a spelling convention |
47 | 47 | # which conforms to "World English" standards; however, git itself adopts |
48 | -# "US English" convention. Thus, we must also declare "--color" as alias | |
49 | -# for "--colour", and since this makes most of the possible abbreviations | |
50 | -# ambiguous, we must also explicitly declare those abbreviations: | |
48 | +# "US English" convention. Thus, we must also accommodate users who will | |
49 | +# specify "--color" instead of "--colour", without creating any ambiguity | |
50 | +# in the possible abbreviations; to achieve this, we check for "--color", | |
51 | +# among the command-line arguments, replacing it with "--colour", BEFORE | |
52 | +# we allow git to parse them. | |
51 | 53 | # |
52 | -OPTIONS_SPEC="$OPTIONS_SPEC | |
53 | -color?* hidden alias for --colour | |
54 | -colo?* hidden alias for --colour | |
55 | -col?* hidden alias for --colour | |
56 | -co?* hidden alias for --colour | |
57 | -],c?* hidden alias for --colour" | |
54 | +for mq_argv | |
55 | +do case "$mq_argv" in | |
56 | + --color*) mq_argv=`echo $mq_argv | sed 's/^--colo/&u/'` ;; | |
57 | + --no-color) mq_argv="--no-colour" ;; | |
58 | + esac | |
59 | + ${mq_argv_init-true} && { set -- "$mq_argv"; mq_argv_init=false | |
60 | + } || set -- "$@" "$mq_argv" | |
61 | +done | |
58 | 62 | |
63 | +# Now, we may let git parse the command line, and set up its shell script | |
64 | +# processing environment, for use within a git working directory tree. | |
65 | +# | |
59 | 66 | SUBDIRECTORY_OK=true . "`git --exec-path`/git-sh-setup" && require_work_tree |
60 | 67 | |
61 | 68 | libexecdir=`dirname "$0"` |