diff options
author | Denis Isidoro <denisidoro@users.noreply.github.com> | 2021-04-19 10:51:24 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 10:51:24 -0300 |
commit | 1aab69e1185aec8aeb40bca8c7fd9b6f1bd67126 (patch) | |
tree | 0e1f84896cb986fcbc40ae6f2bb083dcdfb5a17d | |
parent | 7c62a5af7b1184777afa4801a56bc9aa46218d60 (diff) |
Install: add to $PATH (#530)v2.16.0
-rwxr-xr-x | scripts/install | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/scripts/install b/scripts/install index e857a23..3ff4e42 100755 --- a/scripts/install +++ b/scripts/install @@ -215,6 +215,19 @@ get_shell() { # main # ===================== +export_path_cmd() { + echo + echo ' export PATH="${PATH}:'"$BIN_DIR"'"' +} + +append_to_file() { + local -r path="$1" + local -r text="$2" + if [ -f "$path" ]; then + echo "$text" >> "$path" + fi +} + install_navi() { local -r target="$(get_target)" @@ -245,9 +258,10 @@ install_navi() { if echo "$PATH" | grep -q "$BIN_DIR"; then : else - echoerr - log::note 'Please add the following to your .bashrc-like file:' - echo -e ' export PATH="${PATH}:'"$BIN_DIR"'"\n' + local -r cmd="$(export_path_cmd)" + append_to_file "${HOME}/.bashrc" "$cmd" + append_to_file "${ZDOTDIR:-"$HOME"}/.zshrc" "$cmd" + append_to_file "${HOME}/.fishrc" "$cmd" fi log::note "To call navi, restart your shell or reload your .bashrc-like config file" |