File tree 1 file changed +10
-8
lines changed
cabal-install/bash-completion
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 4
4
#
5
5
6
6
# List cabal targets by type, pass:
7
- # - Test-Suite for test suites
8
- # - Benchmark for benchmarks
9
- # - Test-Suite|Benchmark for both
7
+ # - test-suite for test suites
8
+ # - benchmark for benchmarks
9
+ # - executable for executables
10
+ # - executable|test-suite|benchmark for the three
10
11
_cabal_list()
11
12
{
12
13
cat *.cabal |
13
- grep -E "$1 " |
14
+ grep -Ei "^[[:space:]]*($1)[[:space:]] " |
14
15
sed -e "s/.* \([^ ]*\).*/\1/"
15
16
}
16
17
@@ -24,10 +25,11 @@ _cabal_targets()
24
25
[ -f *.cabal ] || return 0
25
26
local comp
26
27
for comp in $*; do
27
- [ $comp == build ] && _cabal_list "Test-Suite|Benchmark" && break
28
- [ $comp == repl ] && _cabal_list "Test-Suite|Benchmark" && break
29
- [ $comp == test ] && _cabal_list "Test-Suite" && break
30
- [ $comp == bench ] && _cabal_list "Benchmark" && break
28
+ [ $comp == build ] && _cabal_list "executable|test-suite|benchmark" && break
29
+ [ $comp == repl ] && _cabal_list "executable|test-suite|benchmark" && break
30
+ [ $comp == run ] && _cabal_list "executable" && break
31
+ [ $comp == test ] && _cabal_list "test-suite" && break
32
+ [ $comp == bench ] && _cabal_list "benchmark" && break
31
33
done
32
34
}
33
35
You can’t perform that action at this time.
0 commit comments