-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinclude.sh
More file actions
executable file
·35 lines (31 loc) · 860 Bytes
/
include.sh
File metadata and controls
executable file
·35 lines (31 loc) · 860 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
easilyENV="${HOME}/.config/easily/.env"
mkdir -p "${HOME}/.config/easily"
touch "${easilyENV}"
selfArg="$BASH_SOURCE"
if [ -z "$selfArg" ]; then
selfArg="$0"
fi
self=$(realpath "$selfArg" 2> /dev/null)
if [ -z "$self" ]; then
self="$selfArg"
fi
EASILY_ROOT=$(cd "${self%[/\\]*}" > /dev/null; pwd)
echo "EASILY_ROOT=${EASILY_ROOT}" > "${easilyENV}"
source "${easilyENV}"
function easily() {
source "${EASILY_ROOT}/scripts/easily/functions.sh"
if [ -z "$1" ]; then
local action="help";
else
local action="$1"
fi
if [ -f "${EASILY_ROOT}/scripts/easily/commands/${action}.sh" ]; then
. "${EASILY_ROOT}/scripts/easily/commands/${action}.sh"
return $?
fi
echo "\"$action\" Invalid argument";
easily help
}
#alias e="bash -c 'source ${EASILY_ROOT%,}/include.sh && easily' $@"
# need to `sudo apt install jq`
alias e=easily