feat(install_apps): add selection menu

This commit is contained in:
Mohammad Rafiq 2025-02-17 03:19:33 +08:00
parent 171f7b41f5
commit 3dbfca855d

View file

@ -1,6 +1,55 @@
# installs stable nvim function display_menu {
echo "Select applications to install:"
echo "1. All of the following"
echo "2. Neovim (stable)"
echo "0. Exit"
echo -n "Enter your choice (0-2): "
}
wget --output-document ~/nvim.tar.gz https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz # installs stable nvim
tar xvf ~/nvim.tar.gz > /dev/null function install_neovim {
mv nvim-linux-x86_64/ nvim/ wget --output-document ~/nvim.tar.gz https://github.com/neovim/neovim/releases/download/stable/nvim-linux-x86_64.tar.gz > /dev/null 2>&1
rm nvim.tar.gz tar xvf ~/nvim.tar.gz > /dev/null
mv nvim-linux-x86_64 nvim
rm nvim.tar.gz
}
# Main Logic
if ! command -v wget &> /dev/null; then
echo "Error: wget is not installed. Please install it before running this script."
return 1
fi
display_menu
read choice
# 1 for all
case "$choice" in
1)
echo "Installing all apps."
install_neovim
if [ $? -eq 0 ]; then
echo "Installation complete."
else
echo "Installation failed."
fi
;;
2)
echo "Installing neovim stable."
install_neovim
if [ $? -eq 0 ]; then
echo "Installation complete."
else
echo "Installation failed."
fi
;;
0)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid choice. Please enter a number between 0 and 2."
;;
esac
exit 0