Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | ###-begin-karma-completion-###
|
---|
| 2 | #
|
---|
| 3 | # karma command completion script
|
---|
| 4 | # This is stolen from npm. Thanks @isaac!
|
---|
| 5 | #
|
---|
| 6 | # Installation: karma completion >> ~/.bashrc (or ~/.zshrc)
|
---|
| 7 | # Or, maybe: karma completion > /usr/local/etc/bash_completion.d/karma
|
---|
| 8 | #
|
---|
| 9 |
|
---|
| 10 | if type complete &>/dev/null; then
|
---|
| 11 | __karma_completion () {
|
---|
| 12 | local si="$IFS"
|
---|
| 13 | IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
|
---|
| 14 | COMP_LINE="$COMP_LINE" \
|
---|
| 15 | COMP_POINT="$COMP_POINT" \
|
---|
| 16 | karma completion -- "${COMP_WORDS[@]}" \
|
---|
| 17 | 2>/dev/null)) || return $?
|
---|
| 18 | IFS="$si"
|
---|
| 19 | }
|
---|
| 20 | complete -F __karma_completion karma
|
---|
| 21 | elif type compdef &>/dev/null; then
|
---|
| 22 | __karma_completion() {
|
---|
| 23 | si=$IFS
|
---|
| 24 | compadd -- $(COMP_CWORD=$((CURRENT-1)) \
|
---|
| 25 | COMP_LINE=$BUFFER \
|
---|
| 26 | COMP_POINT=0 \
|
---|
| 27 | karma completion -- "${words[@]}" \
|
---|
| 28 | 2>/dev/null)
|
---|
| 29 | IFS=$si
|
---|
| 30 | }
|
---|
| 31 | compdef __karma_completion karma
|
---|
| 32 | elif type compctl &>/dev/null; then
|
---|
| 33 | __karma_completion () {
|
---|
| 34 | local cword line point words si
|
---|
| 35 | read -Ac words
|
---|
| 36 | read -cn cword
|
---|
| 37 | let cword-=1
|
---|
| 38 | read -l line
|
---|
| 39 | read -ln point
|
---|
| 40 | si="$IFS"
|
---|
| 41 | IFS=$'\n' reply=($(COMP_CWORD="$cword" \
|
---|
| 42 | COMP_LINE="$line" \
|
---|
| 43 | COMP_POINT="$point" \
|
---|
| 44 | karma completion -- "${words[@]}" \
|
---|
| 45 | 2>/dev/null)) || return $?
|
---|
| 46 | IFS="$si"
|
---|
| 47 | }
|
---|
| 48 | compctl -K __karma_completion karma
|
---|
| 49 | fi
|
---|
| 50 | ###-end-karma-completion-###
|
---|
Note:
See
TracBrowser
for help on using the repository browser.