Skip to content

Commit 22c3fd3

Browse files
Shell RC reload header should support Homebrew binary location (#11)
1 parent e17b365 commit 22c3fd3

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

docs-site/site/content/docs/latest/configuration/shell-support.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ Since it is not possible to tamper with parent shell process environment from a
3636
# The following script will source a reload_session.sh script under
3737
# current shell session without creating a nested shell session.
3838
#############################################################################
39+
dotfiles_cli_install_path=$(command -v dotfiles)
40+
# Path resolution to support Homebrew installation
41+
if [[ ${dotfiles_cli_install_path} == /usr/local/bin/dotfiles ]]; then
42+
homebrew_dotfiles_cli_install_path=$(dirname $(readlink ${dotfiles_cli_install_path}))
43+
homebrew_dotfiles_cli_install_path=${homebrew_dotfiles_cli_install_path/bin/libexec}
44+
homebrew_dotfiles_cli_install_path=${homebrew_dotfiles_cli_install_path/..\/Cellar//usr/local/Cellar}
45+
DOTFILES_CLI_INSTALL_PATH=${homebrew_dotfiles_cli_install_path}
46+
fi
47+
3948
DOTFILES_CLI_INSTALL_PATH=${DOTFILES_CLI_INSTALL_PATH:-${HOME}/.config/dotfiles-cli}
4049
DOTFILES_CLI_RELOAD_SESSION_SCRIPT_PATH=${DOTFILES_CLI_INSTALL_PATH}/reload_session.sh
4150

@@ -44,7 +53,7 @@ if [[ -e ${DOTFILES_CLI_RELOAD_SESSION_SCRIPT_PATH} ]]; then
4453
source ${DOTFILES_CLI_RELOAD_SESSION_SCRIPT_PATH}
4554
else
4655
echo -e 'Dotfiles CLI is not installed, cannot load plugins/reload session. path: $DOTFILES_CLI_INSTALL_PATH'
47-
fi
56+
fi
4857
```
4958

5059
{{< callout info >}}

dotfiles.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ SHELL_RC_FILE_HEADER="""\\
8383
# The following script will source a reload_session.sh script under \\
8484
# current shell session without creating a nested shell session. \\
8585
############################################################################# \\
86+
dotfiles_cli_install_path=\$(command -v dotfiles) \\
87+
# Path resolution to support Homebrew installation \\
88+
if [[ \${dotfiles_cli_install_path} == /usr/local/bin/dotfiles ]]; then \\
89+
homebrew_dotfiles_cli_install_path=\$(dirname \$(readlink \${dotfiles_cli_install_path})) \\
90+
homebrew_dotfiles_cli_install_path=\${homebrew_dotfiles_cli_install_path/bin/libexec} \\
91+
homebrew_dotfiles_cli_install_path=\${homebrew_dotfiles_cli_install_path/..\\\\/Cellar//usr/local/Cellar} \\
92+
DOTFILES_CLI_INSTALL_PATH=\${homebrew_dotfiles_cli_install_path} \\
93+
fi \\
94+
\\
8695
DOTFILES_CLI_INSTALL_PATH=\${DOTFILES_CLI_INSTALL_PATH:-\${HOME}/.config/dotfiles-cli} \\
8796
DOTFILES_CLI_RELOAD_SESSION_SCRIPT_PATH=\${DOTFILES_CLI_INSTALL_PATH}/reload_session.sh \\
8897
\\

0 commit comments

Comments
 (0)