forked from vfxetc/sitetools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc.sh
More file actions
41 lines (30 loc) · 875 Bytes
/
bashrc.sh
File metadata and controls
41 lines (30 loc) · 875 Bytes
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
# Dev is a wrapper, so add completions.
# `dev [-u <user>] [<command> [<args>]]`
function _dev_completions {
local cword pword
cword="${COMP_WORDS[COMP_CWORD]}"
pword="${COMP_WORDS[$((COMP_CWORD - 1))]}"
case "$pword" in
-u | --user )
COMPREPLY=( $(compgen -u -- "$cword") )
;;
esac
}
complete -cf -F _dev_completions dev
function dev-shell {
# Save all of the KS variables so that we can restore them.
export _OLD_KS_ENV="$(env | grep '^KS_')"
eval "$(dev --export "$@")"
}
function dev-deactivate {
if [[ -n "$_OLD_KS_ENV" ]]; then
# Wipe out the current KS variables.
local name
for name in $(env | grep '^KS_' | cut -d= -f1); do
unset $name
done
# Restore!
eval "$_OLD_KS_ENV"
unset _OLD_KS_ENV
fi
}