@@ -72,6 +72,61 @@ if $MINIMAL_MODE; then
7272 SKIP_FETCH=true
7373fi
7474
75+ # ## === Defaults & Constants ===
76+ UV_PYTHON_VERSION=' 3.13'
77+
78+ COMMON_RC_LINES=(
79+ " [[ -f ~/.shell_aliases ]] && source ~/.shell_aliases"
80+ " [[ -f ~/.shell_functions ]] && source ~/.shell_functions"
81+ " [[ -f ~/.git_aliases ]] && source ~/.git_aliases"
82+ " [[ -f ~/.git_functions ]] && source ~/.git_functions"
83+ " [[ -f ~/.history_settings ]] && source ~/.history_settings"
84+ " [[ -f ~/.omp_init ]] && source ~/.omp_init"
85+ ' [[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH"'
86+ ' [[ -f "$HOME/.local/share/swiftly/env.sh" ]] && . "$HOME/.local/share/swiftly/env.sh"'
87+ )
88+
89+ NVM_RC_LINES=(
90+ ' export NVM_DIR="$HOME/.nvm"'
91+ ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
92+ ' [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"'
93+ )
94+
95+ HOMEBREW_RC_LINES=(
96+ ' eval "$(/opt/homebrew/bin/brew shellenv)"'
97+ ' eval "$(/usr/local/bin/brew shellenv)"'
98+ )
99+
100+ PATH_DEDUP_MARKER=' # PATH de-dup (dotfiles installer)'
101+ BASH_PATH_DEDUP_LINE=' [ -x /usr/bin/awk ] && [ -x /usr/bin/paste ] && [ -x /usr/bin/tr ] && PATH="$([ -x /usr/bin/printf ] && /usr/bin/printf %s "$PATH" | /usr/bin/tr ":" "\n" | /usr/bin/awk ' \' ' !seen[$0]++' \' ' | /usr/bin/paste -sd:)" && export PATH'
102+
103+ # ## === Define dotfiles ===
104+ BASEDIR=$( cd " $( dirname " $0 " ) " && pwd)
105+ DOTFILES_HOME=" $BASEDIR "
106+
107+ SYMLINK_KEYS=(
108+ " $HOME /.shell_aliases"
109+ " $HOME /.shell_functions"
110+ " $HOME /.history_settings"
111+ " $HOME /.omp_init"
112+ " $HOME /.nanorc"
113+ " $HOME /.git_aliases"
114+ " $HOME /.git_functions"
115+ " $HOME /.global.gitignore"
116+ )
117+ SYMLINK_VALUES=(
118+ " $DOTFILES_HOME /general/.aliases"
119+ " $DOTFILES_HOME /general/.functions"
120+ " $DOTFILES_HOME /general/.history_settings"
121+ " $DOTFILES_HOME /general/.omp_init"
122+ " $DOTFILES_HOME /nano/.nanorc"
123+ " $DOTFILES_HOME /git/.git_aliases"
124+ " $DOTFILES_HOME /git/.git_functions"
125+ " $DOTFILES_HOME /git/global.gitignore"
126+ )
127+
128+ REQUIRED_TOOLS=(nano docker swift git)
129+
75130# ## === Detect Environment ===
76131OS=" $( uname -s) "
77132SHELL_NAME=$( basename " $SHELL " )
@@ -175,63 +230,6 @@ apply_rc_lines() {
175230 done
176231}
177232
178- COMMON_RC_LINES=(
179- " [[ -f ~/.shell_aliases ]] && source ~/.shell_aliases"
180- " [[ -f ~/.shell_functions ]] && source ~/.shell_functions"
181- " [[ -f ~/.git_aliases ]] && source ~/.git_aliases"
182- " [[ -f ~/.git_functions ]] && source ~/.git_functions"
183- " [[ -f ~/.history_settings ]] && source ~/.history_settings"
184- " [[ -f ~/.omp_init ]] && source ~/.omp_init"
185- ' [[ -d "$HOME/.local/bin" ]] && export PATH="$HOME/.local/bin:$PATH"'
186- ' [[ -f "$HOME/.local/share/swiftly/env.sh" ]] && . "$HOME/.local/share/swiftly/env.sh"'
187- )
188-
189- NVM_RC_LINES=(
190- ' export NVM_DIR="$HOME/.nvm"'
191- ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"'
192- ' [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"'
193- )
194-
195- HOMEBREW_RC_LINES=(
196- ' eval "$(/opt/homebrew/bin/brew shellenv)"'
197- ' eval "$(/usr/local/bin/brew shellenv)"'
198- )
199-
200- PATH_DEDUP_MARKER=' # PATH de-dup (dotfiles installer)'
201- UV_PYTHON_VERSION=' 3.13'
202-
203- # ## === Define dotfiles ===
204- # Feel free to extend the SYMLINKS array if new files/folders are added
205- BASEDIR=$( cd " $( dirname " $0 " ) " && pwd)
206- DOTFILES_HOME=" $BASEDIR "
207-
208- if ! $DRY_RUN ; then
209- mkdir -p " $HOME /.local/bin"
210- mkdir -p " $HOME /.local/share/swiftly"
211- fi
212-
213- # Create SYMLINKS map in a way compatible with both Bash and Zsh
214- SYMLINK_KEYS=(
215- " $HOME /.shell_aliases"
216- " $HOME /.shell_functions"
217- " $HOME /.history_settings"
218- " $HOME /.omp_init"
219- " $HOME /.nanorc"
220- " $HOME /.git_aliases"
221- " $HOME /.git_functions"
222- " $HOME /.global.gitignore"
223- )
224- SYMLINK_VALUES=(
225- " $DOTFILES_HOME /general/.aliases"
226- " $DOTFILES_HOME /general/.functions"
227- " $DOTFILES_HOME /general/.history_settings"
228- " $DOTFILES_HOME /general/.omp_init"
229- " $DOTFILES_HOME /nano/.nanorc"
230- " $DOTFILES_HOME /git/.git_aliases"
231- " $DOTFILES_HOME /git/.git_functions"
232- " $DOTFILES_HOME /git/global.gitignore"
233- )
234-
235233run_uninstall () {
236234 echo -e " \n🧹 Uninstalling dotfiles symlinks and shell rc additions..."
237235 # Remove symlinks we manage if they point to our repo
639637# ## === Check for other tools used in aliases/functions ===
640638echo -e " \n🔍 Checking for other recommended tools..."
641639
642- REQUIRED_TOOLS=(nano docker swift git)
643-
644640for tool in " ${REQUIRED_TOOLS[@]} " ; do
645641 if ! command -v " $tool " > /dev/null 2>&1 ; then
646642 echo " ⚠️ $tool not found. Some aliases or functions may not work correctly."
@@ -713,8 +709,6 @@ configure_shell_rc() {
713709 fi
714710}
715711
716- BASH_PATH_DEDUP_LINE=' [ -x /usr/bin/awk ] && [ -x /usr/bin/paste ] && [ -x /usr/bin/tr ] && PATH="$([ -x /usr/bin/printf ] && /usr/bin/printf %s "$PATH" | /usr/bin/tr ":" "\n" | /usr/bin/awk ' \' ' !seen[$0]++' \' ' | /usr/bin/paste -sd:)" && export PATH'
717-
718712if [[ " $SHELL_NAME " == " zsh" ]]; then
719713 configure_shell_rc " zsh" " $HOME /.zshrc" " /usr/share/fzf/key-bindings.zsh" " /usr/share/fzf/completion.zsh" ' typeset -U path'
720714fi
0 commit comments