From 85608296833b5ef6d23c87be1e5131de563a6c85 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Wed, 5 Dec 2018 03:01:05 +0900 Subject: [PATCH] Add test autocompletion for zsh https://github.com/scalacenter/bloop/issues/426 --- etc/zsh/_bloop | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/etc/zsh/_bloop b/etc/zsh/_bloop index bbad483c29..4405477d48 100644 --- a/etc/zsh/_bloop +++ b/etc/zsh/_bloop @@ -52,6 +52,16 @@ _flags_for_cmd() { return 0 } +_tests_or_flags() { + local prev=${words[CURRENT-1]} + local cmd=${words[1]} + if [[ $prev = '--only' || $prev = '-o' ]] && [[ $cmd = 'test' ]] then + _testsfqcn + else + _flags + fi +} + _project_or_flags() { local project_cmd=($(bloop autocomplete --format zsh --mode project-commands)) local cmd=${words[2]} @@ -74,6 +84,6 @@ _project_or_flags() { _arguments \ ":command:_commands" \ ":project_or_flags:_project_or_flags" \ - "*::flags:_flags" + "*::flags:_tests_or_flags" return 0