-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_devel
48 lines (34 loc) · 1.04 KB
/
.bash_devel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# just source this file into your .bashrc by
# . ${HOME}/.bash_devel
# or
# [ -f ${HOME}/.bash_devel ] && source ${HOME}/.bash_devel
if [ -f /etc/bash_completion ] ||\
[ -f /usr/local/etc/bash_completion ] ||\
[ -f /opt/homebrew/etc/bash_completion ]; then
PROJ_DIR=${HOME}/myProjects
# files are excluded
# directories prefixed by _ are excluded too
function _goproj_completion() {
local cur prev projects all_list
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
all_list=$(cd ${PROJ_DIR} && echo [^_]* [^_]*/* [^_]*/*/*)
projects=''
for i in ${all_list}; do
[ -d ${PROJ_DIR}/${i}/.git ] && projects="${projects} ${i}"
done
COMPREPLY=( $(compgen -W "${projects}" -- ${cur}) )
return 0
}
complete -F _goproj_completion goproj
# call `goproj` + <tab> from command line
# to bring your shell into the project's dir
# from everywhere
function goproj(){
cd ${PROJ_DIR}/$1
}
fi
# in order to use ncurses' prompt with gnupg for pkg signing
GPG_TTY=$(tty)
export GPG_TTY