Skip to content

Commit a6cf1a7

Browse files
committed
WIP: continue work on new setup-shell experience (part 3)
had to split allow/disallow and login, as the flow was too confusing with them as one now actions are: install/uninstall, configure/deconfigure, allow/disallow, login implemented the arg handling fixed duplication and detection and exclusions etc for basenames and paths also innovated with ksh and dash config loading, they can now be toggled independently need to apply configuration saving now, setup-util-$shell configuration/deconfiguration, etc also fix linting issues
1 parent fd4dd9a commit a6cf1a7

File tree

5 files changed

+447
-301
lines changed

5 files changed

+447
-301
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ For each shell that you configured during the Dorothy installation (can be recon
240240
- [Nu](https://www.nushell.sh) loads our [`init.nu`](https://github.com/bevry/dorothy/blob/master/init.nu) script
241241
- [Xonsh](https://xon.sh) loads our [`init.xsh`](https://github.com/bevry/dorothy/blob/master/init.xsh) script
242242
- POSIX shells ([Bash](<https://en.wikipedia.org/wiki/Bash_(Unix_shell)>), [Zsh](https://en.wikipedia.org/wiki/Z_shell), [Dash](https://wiki.archlinux.org/title/Dash), [KSH](https://en.wikipedia.org/wiki/KornShell), etc) load our [`init.sh`](https://github.com/bevry/dorothy/blob/master/init.sh) script
243+
- KSH and Dash first load their respective `init.ksh` and `init.dash` scripts before loading `init.sh`. This is because KSH, Dash, and Bash all share the same `.profile` configuration file, so different initialization scripts allow us to configure each of them independently.
243244

244245
1. The initialization script will:
245246

commands/debug-bash

+7-7
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function debug_bash() (
101101
option_cmd[0]="$(type -P "$cmd_first")"
102102

103103
# resolve bash path
104-
local cmd=() exit_status=0
104+
local cmd=() __exit_status=0
105105
if [[ ${#option_bash_binaries[@]} -ne 0 ]]; then
106106
local bash_input bash_path bash_binary bash_version
107107
for bash_input in "${option_bash_binaries[@]}"; do
@@ -112,14 +112,14 @@ function debug_bash() (
112112
bash_binary="$(type -P "$bash_input" || :)"
113113
if [[ -z $bash_binary ]]; then
114114
echo-style --error="The bash binary [$bash_input] does not exist."
115-
exit_status=2 # ENOENT 2 No such file or directory
115+
__exit_status=2 # ENOENT 2 No such file or directory
116116
continue
117117
fi
118118
bash_version="$("$bash_binary" -c 'IFS=. read -r BASH_VERSION_MAJOR BASH_VERSION_MINOR BASH_VERSION_PATCH <<<"${BASH_VERSION%%(*}"; printf '%s' "${BASH_VERSION_MAJOR}.${BASH_VERSION_MINOR}.${BASH_VERSION_PATCH}"')"
119119
# check bash version
120120
if [[ $bash_version == '4.1'* || $bash_version == '3.1'* || $bash_version == '3.0'* || $bash_version == '2.'* || $bash_version == '1.'* || $bash_version == '0.'* ]]; then
121121
echo-style --error="The bash binary [$bash_input] is version [$bash_version], which is not supported."
122-
exit_status=75 # EPROGMISMATCH 75 Program version wrong
122+
__exit_status=75 # EPROGMISMATCH 75 Program version wrong
123123
continue
124124
fi
125125
bash_path="$(fs-temp --directory='debug-bash' --directory="custom-path-for-bash-$bash_version" --directory --touch)"
@@ -133,9 +133,9 @@ function debug_bash() (
133133
cmd=(eval-helper --verbose --wrap --command="${cmd[*]/$PATH/\"\$PATH\"}" -- "${cmd[@]}")
134134
fi
135135
if [[ $option_continue == 'yes' ]]; then
136-
"${cmd[@]}" || exit_status=$?
136+
"${cmd[@]}" || __exit_status=$? # eval
137137
else
138-
"${cmd[@]}"
138+
"${cmd[@]}" # eval
139139
fi
140140
done
141141
else
@@ -149,8 +149,8 @@ function debug_bash() (
149149
fi
150150
"${cmd[@]}" # eval
151151
fi
152-
if [[ $exit_status -ne 0 ]]; then
153-
return "$exit_status"
152+
if [[ $__exit_status -ne 0 ]]; then
153+
return "$__exit_status"
154154
fi
155155
)
156156

0 commit comments

Comments
 (0)