forked from cmcculloh/GitScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_gsinit.sh
More file actions
executable file
·69 lines (61 loc) · 2.54 KB
/
_gsinit.sh
File metadata and controls
executable file
·69 lines (61 loc) · 2.54 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## /*
# @description
# This file is the main controller for all GitScripts. It loads the necessary environment
# variables, aliases, and scripts that make GitScripts do it's thing. In order for
# GitScripts to functions properly, you must source this file from your ~/.bashrc,
# ~/.bash_profile, or some other script that loads automatically when you open your
# CLI.
#
# Since this file is under source control, you should not make changes to it that you
# wish to persist. Instead, COPY (since it is also source-controlled) the contents of
# the cfg/user.overrides.example file into cfg/user.overrides (which you must create)
# and edit it to your heart's content.
# description@
#
# @notes
# - The user.overrides file is loaded BEFORE the gs.cfg file so that other variables
# that use previously defined variables in their definition are defined according to
# user changes. This is because all variables defined in gs.cfg first check for the
# existence of a variable before defining it.
# notes@
#
# @dependencies
# cfg/vars.cfg
# dependencies@
#
# @file _gsinit.sh
## */
# determine the path to this script. it will become the gitscripts path. the cfg directory
# must live in the same directory as this script for any user overrides to take effect.
SCRIPT_PATH="${BASH_SOURCE[0]}"
if [ -h "${SCRIPT_PATH}" ]; then
while [ -h "${SCRIPT_PATH}" ]; do
SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`
done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_PATH}` > /dev/null
export SCRIPT_PATH=`pwd`;
export gitscripts_path="${SCRIPT_PATH}/"
popd > /dev/null
export gitscripts_cfg_path="${gitscripts_path}cfg/"
# load user overrides.
if [ -f "${gitscripts_cfg_path}user.overrides" ]; then
source "${gitscripts_cfg_path}user.overrides"
fi
# load gitscripts variables config. fail if vars config can't be found.
if [ -s "${gitscripts_cfg_path}vars.cfg" ]; then
source "${gitscripts_cfg_path}vars.cfg"
else
echo "GitScripts could not load it's main configuration file (cfg/vars.cfg) because it is missing or empty."
exit 1
fi
# load other foundational files. The order here is intentional! see files for documentation.
# note: you will have to re-define any of your personal aliases which conflict with GitScripts aliases
# sometime AFTER your have sourced this file (_gsinit.sh). The cfg/user.overrides will NOT work for aliases.
source "${gitscripts_cfg_path}colors.cfg"
source "${gitscripts_lib_path}source_files.sh"
source "${gitscripts_cfg_path}completion.cfg"
source "${gitscripts_cfg_path}flagged_actions.cfg"
source "${gitscripts_cfg_path}aliases.cfg"
#source "${gitscripts_cfg_path}"