improve install script
This commit is contained in:
+39
-34
@@ -192,11 +192,49 @@ set_up_vim() {
|
|||||||
setup_vimplug
|
setup_vimplug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# zoxide requres extra shell configuration setup
|
||||||
|
set_up_zoxide_shell_config() {
|
||||||
|
local source_cmd_zsh='eval "$(zoxide init zsh)"'
|
||||||
|
local source_cmd_bash='eval "$(zoxide init bash)"'
|
||||||
|
if program_exists "zsh"; then
|
||||||
|
# if not already contain source command
|
||||||
|
file_contains "$source_cmd_zsh" ~/.zshrc
|
||||||
|
status_code=$?
|
||||||
|
if [ "$status_code" != '0' ]; then
|
||||||
|
echo "Install zoxide source command ($source_cmd_zsh) for zsh shell?('y' install; 'q' quit the scrip)"
|
||||||
|
read -r respond
|
||||||
|
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||||
|
echo "$source_cmd_zsh" >> $HOME/.zshrc
|
||||||
|
elif [ "$respond" = "q" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
success "add ($source_cmd_zsh) to zsh"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if program_exists "bash"; then
|
||||||
|
# if not already contain source command
|
||||||
|
file_contains "$source_cmd_bash" ~/.bashrc
|
||||||
|
status_code=$?
|
||||||
|
if [ "$status_code" != '0' ]; then
|
||||||
|
echo "Install zoxide source command ($source_cmd_bash) for bash shell?('y' install; 'q' quit the scrip)"
|
||||||
|
read -r respond
|
||||||
|
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
||||||
|
echo "$source_cmd_bash" >> $HOME/.bashrc
|
||||||
|
elif [ "$respond" = "q" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
success "add ($source_cmd_bash) to bash"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
set_up_zoxide() {
|
set_up_zoxide() {
|
||||||
# https://github.com/ajeetdsouza/zoxide
|
# https://github.com/ajeetdsouza/zoxide
|
||||||
|
|
||||||
if program_exists "zoxide"; then
|
if program_exists "zoxide"; then
|
||||||
success "zoxide is already installed"
|
success "zoxide is already installed"
|
||||||
|
set_up_zoxide_shell_config
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -206,40 +244,7 @@ set_up_zoxide() {
|
|||||||
program_must_exist "curl"
|
program_must_exist "curl"
|
||||||
# This will install zoxide into ~/.local
|
# This will install zoxide into ~/.local
|
||||||
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
|
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
|
||||||
|
set_up_zoxide_shell_config
|
||||||
local source_cmd_zsh='eval "$(zoxide init zsh)"'
|
|
||||||
local source_cmd_bash='eval "$(zoxide init bash)"'
|
|
||||||
if program_exists "zsh"; then
|
|
||||||
# if not already contain source command
|
|
||||||
file_contains "$source_cmd_zsh" ~/.zshrc
|
|
||||||
status_code=$?
|
|
||||||
if [ "$status_code" != '0' ]; then
|
|
||||||
echo "Install zoxide source command ($source_cmd_zsh) for zsh shell?('y' install; 'q' quit the scrip)"
|
|
||||||
read -r respond
|
|
||||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
|
||||||
echo "$source_cmd_zsh" >> $HOME/.zshrc
|
|
||||||
elif [ "$respond" = "q" ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
success "add ($source_cmd_zsh) to zsh"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if program_exists "bash"; then
|
|
||||||
# if not already contain source command
|
|
||||||
file_contains "$source_cmd_bash" ~/.bashrc
|
|
||||||
status_code=$?
|
|
||||||
if [ "$status_code" != '0' ]; then
|
|
||||||
echo "Install zoxide source command ($source_cmd_bash) for bash shell?('y' install; 'q' quit the scrip)"
|
|
||||||
read -r respond
|
|
||||||
if [ "$respond" = "y" ] || [ "$respond" = "yes" ]; then
|
|
||||||
echo "$source_cmd_bash" >> $HOME/.bashrc
|
|
||||||
elif [ "$respond" = "q" ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
success "add ($source_cmd_bash) to bash"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ "$respond" = "q" ]; then
|
elif [ "$respond" = "q" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user