changed PATH sourcing
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
while read -l line
|
||||
if string match -q "PATH=*" $line
|
||||
set -l path_value (string replace "PATH=" "" $line)
|
||||
fish_add_path (eval echo $path_value)
|
||||
end
|
||||
end < ~/.env
|
||||
|
||||
|
||||
if status is-interactive
|
||||
# Commands to run for interactive sessions go here
|
||||
source ~/.config/fish/aliases.fish
|
||||
@@ -9,40 +17,66 @@ if test -f ~/.config/fish/conf.d/.secrets.fish
|
||||
end
|
||||
|
||||
# Make tmux run by default on ssh connections
|
||||
if status is-interactive; and test -n "$SSH_CONNECTION"; and test -z "$TMUX"; and type -q tmux
|
||||
tmux attach-session -t default 2>/dev/null; or tmux new-session -s default
|
||||
end
|
||||
# if status is-interactive; and test -n "$SSH_CONNECTION"; and test -z "$TMUX"; and type -q tmux
|
||||
# tmux attach-session -t default 2>/dev/null; or tmux new-session -s default
|
||||
# end
|
||||
|
||||
# PATH additions (deduplicated with fish_add_path)
|
||||
# fish_add_path ~/.local/bin ~/.opencode/bin /opt/nvim-linux-x86_64/bin ~/.cargo/bin
|
||||
|
||||
# Source ~/.env file with PATH deduplication
|
||||
if test -f ~/.env
|
||||
# Read .env file line by line
|
||||
while read -l line
|
||||
# Skip empty lines and comments
|
||||
if test -z "$line"; or string match -q "#*" "$line"
|
||||
continue
|
||||
end
|
||||
# Source ~/.env file with PATH deduplication Claude
|
||||
# while read -l line
|
||||
# if string match -qr '^[A-Z_]+=.*' -- $line
|
||||
# set -xg (string split -m 1 '=' $line)
|
||||
# end
|
||||
# end < ~/.env
|
||||
|
||||
# Check if line sets PATH
|
||||
if string match -q "PATH=*" "$line"
|
||||
# Extract PATH value after =
|
||||
set -l path_value (string replace "PATH=" "" "$line")
|
||||
# Split by : and add each path
|
||||
for p in (string split ":" "$path_value")
|
||||
if test -n "$p"
|
||||
fish_add_path "$p"
|
||||
end
|
||||
end
|
||||
else
|
||||
# Export other variables normally
|
||||
set -l var_name (string split "=" "$line")[1]
|
||||
set -l var_value (string replace "$var_name=" "" "$line")
|
||||
set -gx "$var_name" "$var_value"
|
||||
end
|
||||
end < ~/.env
|
||||
end
|
||||
|
||||
# while read -l line
|
||||
# if string match -q "PATH=*" $line
|
||||
# set -l path_value (string replace "PATH=" "" $line)
|
||||
# fish_add_path (eval echo $path_value)
|
||||
# end
|
||||
# end < ~/.env
|
||||
|
||||
|
||||
|
||||
# # Source ~/.env file with PATH deduplication
|
||||
# if test -f ~/.env
|
||||
# # Read .env file line by line
|
||||
# echo "DEBUG: About to read .env file" >&2
|
||||
# while read -l line
|
||||
# # Skip empty lines and comments
|
||||
# if test -z "$line"; or string match -q "#*" "$line"
|
||||
# continue
|
||||
# end
|
||||
# echo "DEBUG: Processing line: '$line'" >&2
|
||||
# # Check if line sets PATH
|
||||
# if string match -q "PATH=*" "$line"
|
||||
# # Extract PATH value after =
|
||||
# set -l path_value (string replace "PATH=" "" "$line")
|
||||
#
|
||||
# # Safely expand known variables in PATH
|
||||
# set -l expanded_path (string replace '$HOME' $HOME "$path_value")
|
||||
# set expanded_path (string replace '$USER' $USER "$expanded_path")
|
||||
# set expanded_path (string replace '$XDG_CONFIG_HOME' $XDG_CONFIG_HOME "$expanded_path")
|
||||
# set expanded_path (string replace '$XDG_DATA_HOME' $XDG_DATA_HOME "$expanded_path")
|
||||
# echo "DEBUG: Expanded path: '$expanded_path'" >&2
|
||||
#
|
||||
# # Split by : and add each path
|
||||
# for p in (string split ":" "$expanded_path")
|
||||
# if test -n "$p"
|
||||
# fish_add_path "$p"
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
# # Export other variables normally
|
||||
# set -l var_name (string split "=" "$line")[1]
|
||||
# set -l var_value (string replace "$var_name=" "" "$line")
|
||||
# set -gx "$var_name" "$var_value"
|
||||
# end
|
||||
# end < ~/.env
|
||||
# end
|
||||
|
||||
# Netbird completion script
|
||||
# fish completion for netbird -*- shell-script -*-
|
||||
|
||||
Reference in New Issue
Block a user