diff --git a/commands/args.go b/commands/args.go index e98bd802..cb7ff939 100644 --- a/commands/args.go +++ b/commands/args.go @@ -92,9 +92,7 @@ func (a *Args) ToCmd() *cmd.Cmd { } for _, arg := range a.Params { - if arg != "" { - c.WithArg(arg) - } + c.WithArg(arg) } return c diff --git a/commands/args_test.go b/commands/args_test.go index 7ec8842c..41af5d0f 100644 --- a/commands/args_test.go +++ b/commands/args_test.go @@ -120,6 +120,12 @@ func TestArgs_GlobalFlags_Replaced(t *testing.T) { assert.Equal(t, []string{"-a", "http://example.com"}, cmd.Args) } +func TestArgs_ToCmd(t *testing.T) { + args := NewArgs([]string{"a", "", "b", ""}) + cmd := args.ToCmd() + assert.Equal(t, []string{"a", "", "b", ""}, cmd.Args) +} + func TestArgs_GlobalFlags_BeforeAfterChain(t *testing.T) { args := NewArgs([]string{"-c", "key=value", "-C", "dir", "status"}) args.Before("git", "remote", "add")