-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsolicited opinions on setup #20
Comments
Thank you for your thorough feedback and the solutions you've provided. We've planned to combine the scripts into one to prevent any discrepancies. I thought supporting fish would be too much work for this stage, so I skipped that, but with your help seems we'll be able to support it soon. Regarding Linux distribution, if it's not too much work, we can support that. I'll have to figure out what to do about testing that. |
One other thought is that For if ! command -sq mise
fish_add_path -p -P $HOME/.local/bin
end
if command -sq mise
mise activate fish | source
end The latter should be blocked in a |
Resolved maintenance issue by combining scripts in #21. |
Resolved these in #21, #23, and #25. Thanks @halostatue for the suggestions and code snippets! |
I have a few more comments following the latest updates.
|
I'm not sure how to address this. diff --git a/priv/script.sh b/priv/script.sh
index 03f228e..33a243f 100755
--- a/priv/script.sh
+++ b/priv/script.sh
@@ -31,16 +31,18 @@ postgres_version=15.1
case "${SHELL:-}" in
*bash)
current_shell="bash"
- config_file="$HOME/.bashrc"
+ config_dir="$HOME/.config/phx_tools"
+ config_file="$config_dir/shell.sh"
;;
*fish)
current_shell="fish"
- config_file="$HOME/.config/fish/config.fish"
- mkdir -p "$(dirname "$config_file")"
+ config_dir="$HOME/.config/fish/conf.d"
+ config_file="$config_dir/phx_tools.fish"
;;
*zsh)
current_shell="zsh"
- config_file="$HOME/.zshrc"
+ config_dir="$HOME/.config/phx_tools"
+ config_file="$config_dir/shell.sh"
;;
*)
printf "Unsupported shell: %s\n" "$SHELL"
@@ -48,6 +50,8 @@ case "${SHELL:-}" in
;;
esac
+mkdir -p "$config_dir"
+
# Add OS detection
OS="$(uname -s)"
@@ -219,14 +223,21 @@ install() {
curl https://mise.run | sh
case $current_shell in
- "bash")
- echo 'eval "$(~/.local/bin/mise activate bash)"' >>$config_file
- ;;
"fish")
- echo '~/.local/bin/mise activate fish | source' >>$config_file
+ echo 'if status --is-interactive' > "$config_file"
+ echo ' ~/.local/bin/mise activate fish | source' >> "$config_file"
+ echo 'end' >> "$config_file"
;;
- "zsh")
- echo 'eval "$(~/.local/bin/mise activate zsh)"' >>$config_file
+ *)
+ # Shared config for bash/zsh
+ echo '[ -x ~/.local/bin/mise ] && eval "$(~/.local/bin/mise activate bash)"' > "$config_file"
+
+ # Add source line to respective rc files if not already present
+ for rc_file in ~/.bashrc ~/.zshrc; do
+ if [ -f "$rc_file" ] && ! grep -q "source.*phx_tools/shell.sh" "$rc_file"; then
+ echo "source $config_file" >> "$rc_file"
+ fi
+ done
;;
esac
but |
I’ll open a draft PR with a sketch of it. |
I saw your phx.tools update announcement recently on ElixirStatus and have a few observations that you may wish to consider.
Shell Support
bash
andzsh
;fish
is an increasingly popular alternative shell which should be supported. The ideal way to do this is via a new file (~/.config/fish/conf.d/phx_tools.fish
) and the contents should bemise activate fish | source
. If you don't wish to supportfish
, then your documentation should be clear on that.~/.bashrc
and~/.zshrc
if either exists regardless of the current value of$SHELL
(also to the fish config file, but only iffish
is installed).bash
, this would meangrep
ping in~/.bash_profile
,~/.bashrc
, etc.. Forzsh
this would meangrep
ping in~/.zshrc
etc. Forfish
, this would meangrep
ping in~/.config/fish/config.fish
and~/.config/fish/conf.d/*
. This is less problematic than it appears because the only update to the config file happens inmaybe_install mise
, but it is possible that someone already initializesmise
elsewhere behind a test ([[ -x mise ]] && eval "$(mise activate bash)"
).Platform Support
The only Linux distribution family supported is Debian. This should be documented (and eventually expanded; based on what I have seen, supporting dnf and pacman in addition to apt would be sufficient — maybe apk for minimal cases).
Maintenance
There is some divergence in your macOS and Linux scripts that I do not believe you have intended. I believe that you would be better served by serving a single script which supports both macOS and Linux. The differences between the implementations can either be done with "tagged" functions (
maybe_install_macos
,maybe_install_linux
) or conditional definitions:I’m attaching a quick change that should support fish and fix some of the divergence that I mentioned above, but doesn't address anything else that I mentioned.
support fish
The text was updated successfully, but these errors were encountered: