source: frontend/node_modules/jake/bin/bash_completion.sh

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[9af201e]1#!/bin/bash
2
3# http://stackoverflow.com/a/246128
4SOURCE="${BASH_SOURCE[0]}"
5while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
6 DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
7 SOURCE="$(readlink "$SOURCE")"
8 [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
9done
10JAKE_BIN_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
11
12# http://stackoverflow.com/a/12495480
13# http://stackoverflow.com/a/28647824
14_auto_jake()
15{
16 local cur
17 local -a COMPGEN=()
18 _get_comp_words_by_ref -n : -c cur
19
20 # run auto-completions in jake via our auto_complete.js wrapper
21 local -a auto_complete_info=( $(export COMP_LINE="${COMP_LINE}" && ${JAKE_BIN_DIR}/auto_complete.js "$cur" "${3}") )
22 # check reply flag
23 local reply_flag="${auto_complete_info[0]}"
24 if [[ "${reply_flag}" == "no-complete" ]]; then
25 return 1
26 fi
27 local auto_completions=("${auto_complete_info[@]:1}")
28 COMPGEN=( $(compgen -W "${auto_completions[*]}" -- "$cur") )
29 COMPREPLY=( "${COMPGEN[@]}" )
30
31 __ltrim_colon_completions "$cur"
32
33 # do we need another space??
34 if [[ "${reply_flag}" == "yes-space" ]]; then
35 COMPREPLY=( "${COMPGEN[@]}" " " )
36 fi
37
38 return 0
39}
40
41complete -o default -F _auto_jake jake
Note: See TracBrowser for help on using the repository browser.