Skip to content

Commit

Permalink
Various Additions
Browse files Browse the repository at this point in the history
- Added fancy_message script (thanks to https://github.com/wimpysworld/deb-get)
- Added function to check if zsh is installed before adding additions (may need to call this more)
- Added Zap Plugin Manager
  • Loading branch information
Xmetalfanx committed Nov 17, 2023
1 parent dc08fff commit 880cfd0
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 8 deletions.
41 changes: 38 additions & 3 deletions components/general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,40 @@ function userPrompt() {
read -rp "Press Any Key to continue"
}

# function checkLastCommandStatus() {
function checkLastCommandStatus() {

# [ $? == "0" ] && fancy_message info "${1}" || fancy_message error "${2}"
# }
[ $? == "0" ] && fancy_message info "${1}" && result="pass" || fancy_message error "${2}" || result="fail"
}

function fancy_message() {

# can i do the && thing in place of this if statement, here?
if [ -z "${1}" ] || [ -z "${2}" ]; then
return
fi

local RED="\e[31m"
local GREEN="\e[32m"
local YELLOW="\e[33m"
local MAGENTA="\e[35m"
local RESET="\e[0m"
local MESSAGE_TYPE=""
local MESSAGE=""
MESSAGE_TYPE="${1}"
MESSAGE="${2}"

case ${MESSAGE_TYPE} in
info) echo -e " [${GREEN}-${RESET}] ${MESSAGE}";;
action) echo -e " [${YELLOW}*${RESET}] ${MESSAGE}";;
# SHOULD THIS BE BACKWARS WITH THE ? AT THE END?
question) echo -e " [${YELLOW}?${RESET}] ${MESSAGE}";;
recommend) echo -e " [${blue}!${RESET}] ${MESSAGE}";;
# for warnigs that dont need a "Warning: " addition
lwarn) echo -e " [${RED}*${RESET}] ${MESSAGE}";;
warn) echo -e " [${RED}*${RESET}] WARNING! ${MESSAGE}";;
error) echo -e " [${RED}!${RESET}] ERROR! ${MESSAGE}";;
esac
}



Expand Down Expand Up @@ -148,6 +178,11 @@ function downloadOhMyZSH(){

echo "zshCounter=${zshCounter}" > ${settingsFile}

}

function check-if-zsh-is-installed() {
zsh --version && checkLastCommandStatus "zsh is installed" "zsh is not installed yet"

[ "${result}" == "fail" ] && clear && echo "zsh is not installed yet, please install zsh shell first" && selectSetupType

}
10 changes: 10 additions & 0 deletions components/plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,13 @@ function coloredManPages() {

echo -e "colored-man-pages from ${repoName} repo Added\v"
}

function installZapPluginManager() {

# note to self: Official instructions, below

check-if-zsh-is-installed

fancy_message action "Installing Zap Plugin Manager for zsh" && zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) --branch release-v1 && fancy_message info "Zap Plugin Manager now installed, a restart of your terminal maybe needed" || echo "ZSH Shell not installed, yet" || userPrompt

}
13 changes: 8 additions & 5 deletions setupZSH.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ clearZSHRC
function selectSetupType() {

echo -e "Brief Description
ZapPluginManager -
Complete - Adds OhmyZsh and zsh-user plugins manually, theming, tweaks and aliases
NonTheme Complete (NT) - SAME as complete, expect NO THEMING
Medium - Adds theming, tweaks and aliases
Slim - Adds tweaks and aliases
\vDo you want the Slim, Medium or Complete setup?
\vDo you want the Slim, Medium or Complete setup or do you want to install the Zap Plugin Manager?
"
read -rp "(s/m/nt/c)" setupTypeSelection
read -rp "(z/s/m/nt/c)" setupTypeSelection

case $setupTypeSelection in

Expand All @@ -47,14 +48,16 @@ function selectSetupType() {
metaAliasAndOthers
;;

[tT]) clear
[tT]) clear
ohmyzshPlugins
#zshUserPlugins && zshPluginAutoComplete && coloredManPages && userPrompt
#themeChooser
#metaAliasAndOthers
;;

*) echo -e "invalid selection" && sleep 1 && selectSetupType ;;

[zZ]) installZapPluginManager ;;

*) echo -e "invalid selection" && sleep 1 && selectSetupType ;;

esac

Expand Down

0 comments on commit 880cfd0

Please sign in to comment.