Skip to content

Commit

Permalink
chore: added switch_case_indent to editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
busla committed Nov 26, 2024
1 parent 11dc111 commit 4813271
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 98 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[*.sh]
indent_style = space
indent_size = 4
switch_case_indent = true
196 changes: 98 additions & 98 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ ARCH="$(uname -m)"

# Map to FVM naming
case "$OS" in
Linux*) OS='linux' ;;
Darwin*) OS='macos' ;;
*)
log_message "Unsupported OS"
exit 1
;;
Linux*) OS='linux' ;;
Darwin*) OS='macos' ;;
*)
log_message "Unsupported OS"
exit 1
;;
esac

case "$ARCH" in
x86_64) ARCH='x64' ;;
arm64 | aarch64) ARCH='arm64' ;;
armv7l) ARCH='arm' ;;
*)
log_message "Unsupported architecture"
exit 1
;;
x86_64) ARCH='x64' ;;
arm64 | aarch64) ARCH='arm64' ;;
armv7l) ARCH='arm' ;;
*)
log_message "Unsupported architecture"
exit 1
;;
esac

# Terminal colors setup
Expand Down Expand Up @@ -152,113 +152,113 @@ tilde_FVM_DIR_BIN=$(tildify "$FVM_DIR_BIN")
refresh_command=''

case $(basename "$SHELL") in
fish)
commands=(
"set --export PATH $FVM_DIR_BIN \$PATH"
)

fish_config=$HOME/.config/fish/config.fish
tilde_fish_config=$(tildify "$fish_config")

if [[ -w $fish_config ]]; then
{
echo -e '\n# FVM'

for command in "${commands[@]}"; do
echo "$command"
done
} >>"$fish_config"
fish)
commands=(
"set --export PATH $FVM_DIR_BIN \$PATH"
)

log_message "Added \"$tilde_FVM_DIR_BIN\" to \$PATH in \"$tilde_fish_config\""
refresh_command="source $tilde_fish_config"
fish_config=$HOME/.config/fish/config.fish
tilde_fish_config=$(tildify "$fish_config")

else
log_message "Manually add the directory to $tilde_fish_config (or similar):"
if [[ -w $fish_config ]]; then
{
echo -e '\n# FVM'

for command in "${commands[@]}"; do
info_bold " $command"
done
fi
;;
zsh)
commands=(
"export PATH=\"$FVM_DIR_BIN:\$PATH\""
)
for command in "${commands[@]}"; do
echo "$command"
done
} >>"$fish_config"

zsh_config=$HOME/.zshrc
tilde_zsh_config=$(tildify "$zsh_config")
log_message "Added \"$tilde_FVM_DIR_BIN\" to \$PATH in \"$tilde_fish_config\""
refresh_command="source $tilde_fish_config"

if [[ -w $zsh_config ]]; then
{
echo -e '\n# FVM'
else
log_message "Manually add the directory to $tilde_fish_config (or similar):"

for command in "${commands[@]}"; do
echo "$command"
info_bold " $command"
done
} >>"$zsh_config"

log_message "Added \"$tilde_FVM_DIR_BIN\" to \$PATH in \"$tilde_zsh_config\""
refresh_command="source $zsh_config"

else
log_message "Manually add the directory to $tilde_zsh_config (or similar):"

for command in "${commands[@]}"; do
info_bold " $command"
done
fi
;;
bash)
commands=(
"export PATH=$FVM_DIR_BIN:\$PATH"
)

bash_configs=(
"$HOME/.bashrc"
"$HOME/.bash_profile"
)

if [[ ${XDG_CONFIG_HOME:-} ]]; then
bash_configs+=(
"$XDG_CONFIG_HOME/.bash_profile"
"$XDG_CONFIG_HOME/.bashrc"
"$XDG_CONFIG_HOME/bash_profile"
"$XDG_CONFIG_HOME/bashrc"
fi
;;
zsh)
commands=(
"export PATH=\"$FVM_DIR_BIN:\$PATH\""
)
fi

set_manually=true
for bash_config in "${bash_configs[@]}"; do
tilde_bash_config=$(tildify "$bash_config")
zsh_config=$HOME/.zshrc
tilde_zsh_config=$(tildify "$zsh_config")

if [[ -w $bash_config ]]; then
if [[ -w $zsh_config ]]; then
{
echo -e '\n# FVM'

for command in "${commands[@]}"; do
echo "$command"
done
} >>"$bash_config"
} >>"$zsh_config"

log_message "Added \"$tilde_FVM_DIR_BIN\" to \$PATH in \"$tilde_zsh_config\""
refresh_command="source $zsh_config"

else
log_message "Manually add the directory to $tilde_zsh_config (or similar):"

log_message "Added \"$tilde_FVM_DIR_BIN\" to \$PATH in \"$tilde_bash_config\""
refresh_command="source $bash_config"
set_manually=false
break
for command in "${commands[@]}"; do
info_bold " $command"
done
fi
done
;;
bash)
commands=(
"export PATH=$FVM_DIR_BIN:\$PATH"
)

if [[ $set_manually = true ]]; then
log_message "Manually add the directory to $tilde_bash_config (or similar):"
bash_configs=(
"$HOME/.bashrc"
"$HOME/.bash_profile"
)

for command in "${commands[@]}"; do
info_bold " $command"
if [[ ${XDG_CONFIG_HOME:-} ]]; then
bash_configs+=(
"$XDG_CONFIG_HOME/.bash_profile"
"$XDG_CONFIG_HOME/.bashrc"
"$XDG_CONFIG_HOME/bash_profile"
"$XDG_CONFIG_HOME/bashrc"
)
fi

set_manually=true
for bash_config in "${bash_configs[@]}"; do
tilde_bash_config=$(tildify "$bash_config")

if [[ -w $bash_config ]]; then
{
echo -e '\n# FVM'

for command in "${commands[@]}"; do
echo "$command"
done
} >>"$bash_config"

log_message "Added \"$tilde_FVM_DIR_BIN\" to \$PATH in \"$tilde_bash_config\""
refresh_command="source $bash_config"
set_manually=false
break
fi
done
fi
;;
*)
log_message 'Manually add the directory to ~/.bashrc (or similar):'
info_bold " export PATH=\"$FVM_DIR_BIN:\$PATH\""
;;

if [[ $set_manually = true ]]; then
log_message "Manually add the directory to $tilde_bash_config (or similar):"

for command in "${commands[@]}"; do
info_bold " $command"
done
fi
;;
*)
log_message 'Manually add the directory to ~/.bashrc (or similar):'
info_bold " export PATH=\"$FVM_DIR_BIN:\$PATH\""
;;
esac

echo
Expand Down

0 comments on commit 4813271

Please sign in to comment.