From cc3c1f5e9f132716bad18fd8f956bb4ae0517bcb Mon Sep 17 00:00:00 2001 From: memdmp Date: Fri, 17 Jan 2025 19:28:01 +0100 Subject: feat: ensure ~/.local/bin is in path in env.zsh aswell --- env.zsh | 7 +++++++ zuwu.zsh | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/env.zsh b/env.zsh index 04d1be4..2956f63 100644 --- a/env.zsh +++ b/env.zsh @@ -8,6 +8,8 @@ # # Currently, we just ensure your environment is sensible - e.g. we ensure your LANG is well-defined, etc... + +# Validate $LANG is set correctly if [[ "$VALIDATE_LANG" != "false" ]]; then if [[ "$LANG" == "" ]] || [[ "$LANG" == "C" ]]; then # Modern systems will have UTF-8 everywhere outside of a TTY. @@ -22,3 +24,8 @@ if [[ "$VALIDATE_LANG" != "false" ]]; then export LC_ALL="$LANG" fi fi + +# Ensure ~/.local/bin is in the PATH +if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then + export PATH="$PATH:$HOME/.local/bin" +fi diff --git a/zuwu.zsh b/zuwu.zsh index ed13554..e7267e6 100755 --- a/zuwu.zsh +++ b/zuwu.zsh @@ -88,14 +88,11 @@ fi # - noop() {} -# Ensure ~/.local/bin is in the PATH - note that this will "match" if something like `.*$HOME/.local/bin.*`, i don't care -if ! grep "$HOME/.local/bin" <<< "$PATH" >/dev/null 2>/dev/null; then - echo -n 'if ! grep "$HOME/.local/bin" <<< "$PATH" >/dev/null 2>/dev/null; then - export PATH="$PATH:$HOME/.local/bin" -fi -' >> "$HOME/.zshenv" +# Ensure ~/.local/bin is in the PATH +if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then export PATH="$PATH:$HOME/.local/bin" fi + # Ensure ~/.local/bin exists if ! [[ -d "$HOME/.local/bin" ]]; then mkdir "$HOME/.local/bin" || echo "Failed to create '$HOME/.local/bin' for your sanity's sake. For your own sanity, please make this directory." -- cgit v1.2.3