-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcustpathhandler.sh
More file actions
31 lines (25 loc) · 856 Bytes
/
Copy pathcustpathhandler.sh
File metadata and controls
31 lines (25 loc) · 856 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
#! /usr/bin/env bash
# Contains functions for handling all custom .gitignore
# directory related features
function load_dirs() {
if [ -f "${SCRIPTPATH}/dirs.list" ]; then
dirNames=`cat ${SCRIPTPATH}/dirs.list`
else
echo "WARNING: Directory list not compiled"
echo "INFO: Adding default default gitignore directories."
# Add 2 default locations present in github's repository
echo ":${SCRIPTPATH}/gitignore" >> "${SCRIPTPATH}/dirs.list"
if [ -d "${SCRIPTPATH}/global" ]; then
echo "global:${SCRIPTPATH}/global" >> "${SCRIPTPATH}/dirs.list"
fi
load_dirs
return
fi
# Read each line from dirs.list and add an entry to map.
# Lines in dirs.list have pattern:
# alias:path
while read -r line; do
lineSplit=("$line")
dirNameMap["${lineSplit[0]}"]="${lineSplit[1]}"
done < "${SCRIPTPATH}/dirs.list"
}