mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-22 19:43:51 -05:00
Fixed panic on empty strings as arguments -- now just passed through to the command
This commit is contained in:
@@ -58,6 +58,14 @@ func TestParsing(t *testing.T) {
|
||||
map[string]string{"message": "value"},
|
||||
[]string{"b", "c"},
|
||||
},
|
||||
{
|
||||
"empty string",
|
||||
[]*Option{forceOpt, messageOpt},
|
||||
[]string{"b", "--message=value", ""},
|
||||
map[string]string{"message": "value"},
|
||||
[]string{"b", ""},
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
@@ -105,7 +105,7 @@ func (ap *ArgParser) Parse(args []string) (*ArgParseResults, error) {
|
||||
for ; i < len(args); i++ {
|
||||
arg := args[i]
|
||||
|
||||
if arg[0] != '-' {
|
||||
if len(arg) == 0 || arg[0] != '-' { // empty strings should get passed through like other naked words
|
||||
list = append(list, arg)
|
||||
} else {
|
||||
if arg == "--" {
|
||||
|
||||
Reference in New Issue
Block a user