forked from ingydotnet/git-subrepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rc
38 lines (34 loc) · 1.24 KB
/
.rc
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
#!bash
#------------------------------------------------------------------------------
#
# This is the `git-subrepo` initialization script.
#
# This script turns on the `git-subrepo` Git subcommand, its manpages and TAB
# completion for the *Bash* and *zsh* shells.
#
# Just add a line like this to your shell startup configuration:
#
# source /path/to/git-subrepo/.rc
#
#------------------------------------------------------------------------------
if [[ ${BASH_VERSION} ]]; then
if [[ ${BASH_VERSINFO[0]} -lt 4 ]] ; then
echo "The git-subrepo command requires that 'Bash 4+' is installed."
echo "It doesn't need to be your shell, but it must be in your PATH."
if [[ $OSTYPE == darwin* ]]; then
echo "You appear to be on macOS."
echo "Try: 'brew install bash'."
echo "This will not change your user shell, it just installs 'Bash 5.x'."
fi
return
fi
fi
[[ -n ${ZSH_VERSION-} ]] &&
GIT_SUBREPO_ROOT=$0 ||
GIT_SUBREPO_ROOT=$BASH_SOURCE
[[ $GIT_SUBREPO_ROOT =~ ^/ ]] ||
GIT_SUBREPO_ROOT=$PWD/$GIT_SUBREPO_ROOT
export GIT_SUBREPO_ROOT=$(cd "$(dirname "$GIT_SUBREPO_ROOT")"; pwd)
export PATH=$GIT_SUBREPO_ROOT/lib:$PATH
export MANPATH=$GIT_SUBREPO_ROOT/man:$MANPATH
source "$GIT_SUBREPO_ROOT/share/enable-completion.sh"