-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvariables.sh
More file actions
41 lines (39 loc) · 1.25 KB
/
variables.sh
File metadata and controls
41 lines (39 loc) · 1.25 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
readonly _bashbox_meta_name="Bashbox.sh";
# readonly _usemols_meta_name="Usemols.meta"
readonly _src_dir_name="src";
readonly _bashbox_home="${HOME:-"${0%/*}"}/.bashbox" && mkdir -p "$_bashbox_home";
readonly _bashbox_registrydir="$_bashbox_home/registry" && mkdir -p "$_bashbox_registrydir";
readonly _bashbox_bindir="$_bashbox_home/bin" && mkdir -p "$_bashbox_bindir";
readonly _bashbox_posix_envfile="$_bashbox_home/env";
readonly _bashbox_fish_envfile="$_bashbox_home/env.fish";
readonly _bashbox_compat_var_name="BASHBOX_COMPAT";
readonly SUBCOMMANDS_DESC=(
""
"Create a new bashbox project"
"Compile a bashbox project"
"Cleanup target/ directories"
"Install a bashbox project from repo"
"Install bashbox into PATH"
);
# Exports
_var_exports=(
_bashbox_registrydir
)
for _var in "${_var_exports[@]}"; do {
export "$_var";
} done
# Create env file if missing
(
for _envfile in "$_bashbox_posix_envfile" "$_bashbox_fish_envfile"; do {
if test ! -e "$_envfile"; then {
case "$_envfile" in
"$_bashbox_posix_envfile") # bash, ksh, zsh
echo "export PATH=\"$_bashbox_bindir:\$PATH\"" > "$_envfile";
;;
"$_bashbox_fish_envfile") # fish
echo "set PATH \"$_bashbox_bindir\" \"\$PATH\" && export PATH" > "$_envfile";
;;
esac
} fi
} done
) &