mirror of
https://github.com/atuinsh/atuin.git
synced 2025-07-07 13:15:09 +00:00
* fix: support fish plugin in install script * fix sed command on Linux for fish plugin install * light touch refactor for consistent and clearer cross-platform support * start the final end at the beginning of the line * ignore leading whitespace in fish config
This commit is contained in:
parent
b9385d8059
commit
81123b377f
1 changed files with 16 additions and 0 deletions
16
install.sh
16
install.sh
|
@ -53,6 +53,22 @@ if ! grep -q "atuin init bash" ~/.bashrc; then
|
|||
echo 'eval "$(atuin init bash)"' >> ~/.bashrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.config/fish/config.fish" ]; then
|
||||
# Check if the line already exists to prevent duplicates
|
||||
if ! grep -q "atuin init fish" "$HOME/.config/fish/config.fish"; then
|
||||
# Detect BSD or GNU sed
|
||||
if sed --version >/dev/null 2>&1; then
|
||||
# GNU
|
||||
sed -i '/if status is-interactive/,/end/ s/end$/ atuin init fish | source\
|
||||
end/' "$HOME/.config/fish/config.fish"
|
||||
else
|
||||
# BSD (macOS)
|
||||
sed -i '' '/if status is-interactive/,/end/ s/end$/ atuin init fish | source\
|
||||
end/' "$HOME/.config/fish/config.fish"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue