Skip to content

Commit

Permalink
protoc: complete all --*_out without more specific handling with dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Mar 29, 2020
1 parent 9caf5c9 commit a10adf2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions completions/protoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ _protoc()
_init_completion -s || return

case $prev in
--proto_path|--cpp_out|--java_out|--python_out)
_filedir -d
return
;;
--version|-h|--help|--encode|--decode)
return
;;
Expand All @@ -28,6 +24,10 @@ _protoc()
fi
return
;;
--proto_path|--*_out)
_filedir -d
return
;;
esac

$split && return
Expand Down
9 changes: 9 additions & 0 deletions test/t/test_protoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ def test_1(self, completion):
@pytest.mark.complete("protoc -", require_cmd=True)
def test_2(self, completion):
assert completion
assert any(
x.endswith("_out") or x.endswith("_out=") for x in completion
)

@pytest.mark.complete(
"protoc --non_existent_plugin_out ", cwd="shared/default"
)
def test_all_out(self, completion):
assert completion == ["bar bar.d/", "foo.d/"]

0 comments on commit a10adf2

Please sign in to comment.