diff options
| author | Eyal Posener <[email protected]> | 2017-11-04 11:20:50 +0200 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2017-11-04 11:32:33 +0200 |
| commit | aae7e1e39fb3554591e2d20b4c86fea9bf2b15bc (patch) | |
| tree | f9a8fe2a68d6e28755a3ef8fc6b73f99a06d5574 /complete_test.go | |
| parent | 88e59760adaddb8276c9b15511302890690e2dae (diff) | |
Add logic to complete when last flag uses the equal sign
If the last flag is of the form -flag=value, complete the value according to -flag.
Diffstat (limited to 'complete_test.go')
| -rw-r--r-- | complete_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/complete_test.go b/complete_test.go index ba4df4a..cd7880c 100644 --- a/complete_test.go +++ b/complete_test.go @@ -144,14 +144,30 @@ func TestCompleter_Complete(t *testing.T) { want: []string{"./a.txt", "./b.txt", "./c.txt", "./.dot.txt", "./", "./dir/", "./outer/"}, }, { + args: "-o=./", + want: []string{"./a.txt", "./b.txt", "./c.txt", "./.dot.txt", "./", "./dir/", "./outer/"}, + }, + { args: "-o .", want: []string{"./a.txt", "./b.txt", "./c.txt", "./.dot.txt", "./", "./dir/", "./outer/"}, }, { + args: "-o ./b", + want: []string{"./b.txt"}, + }, + { + args: "-o=./b", + want: []string{"./b.txt"}, + }, + { args: "-o ./read", want: []string{}, }, { + args: "-o=./read", + want: []string{}, + }, + { args: "-o ./readme.md", want: []string{}, }, @@ -160,6 +176,10 @@ func TestCompleter_Complete(t *testing.T) { want: []string{"sub1", "sub2"}, }, { + args: "-o=./readme.md ", + want: []string{"sub1", "sub2"}, + }, + { args: "-o sub2 -flag3 ", want: []string{"opt1", "opt2", "opt12"}, }, |
