зеркало из https://github.com/mislav/hub.git
Merge pull request #661 from github/version_help_flags
Delegate `git —-version` and `git —-help` to Hub
This commit is contained in:
Коммит
915f68dd4f
|
@ -173,6 +173,8 @@ func slurpGlobalFlags(args []string) (aa []string, noop bool) {
|
|||
if arg == "--noop" {
|
||||
noop = true
|
||||
aa, _ = removeItem(args, i)
|
||||
} else if arg == "--version" || arg == "--help" {
|
||||
aa[i] = strings.TrimPrefix(arg, "--")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,14 @@ func TestNewArgs(t *testing.T) {
|
|||
assert.Equal(t, "command", args.Command)
|
||||
assert.Equal(t, 1, args.ParamsSize())
|
||||
assert.T(t, args.Noop)
|
||||
|
||||
args = NewArgs([]string{"--version"})
|
||||
assert.Equal(t, "version", args.Command)
|
||||
assert.Equal(t, 0, args.ParamsSize())
|
||||
|
||||
args = NewArgs([]string{"--help"})
|
||||
assert.Equal(t, "help", args.Command)
|
||||
assert.Equal(t, 0, args.ParamsSize())
|
||||
}
|
||||
|
||||
func TestArgs_Words(t *testing.T) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче