Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Commit

Permalink
Redfined show function (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus authored and Landrash committed Mar 7, 2018
1 parent e1fc365 commit bc642e9
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions package/usr/local/bin/hassbian-config
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,38 @@ function get-all-suite-installers {


function show-suites {
echo -e "Install scripts: (Usage 'sudo hassbian-config install \e[32msuite-name\e[0m')"
printf "This is a list over all suites in hassbian-config\\n"
printf "If a \\e[1msuite\\e[0m has \\e[32mgreen color\\e[0m in the name, you have already installed it.\\n"
printf "\\n"
printf "Install scripts: (Usage 'sudo hassbian-config install \\e[1msuite\\e[0m')\\n"
installers=$(get-all-suite-installers)
for i in $installers
do
if [ ! -f $SUITE_CONTROL_DIR/"$i" ]; then
SUITESTATE=""
if [ -f $SUITE_CONTROL_DIR/"$i" ]; then
SUITESTATE=$(grep "SCRIPTSTATE" $SUITE_CONTROL_DIR/"$i" | awk -F'=' '{print $2}')
else
SUITESTATE=$(grep SCRIPTSTATE $SUITE_CONTROL_DIR/"$i" | awk -F'=' '{printf $2}')
SUITESTATE=$(printf "\e[34m $SUITESTATE%-7s")
SUITESTATE=""
fi
INSTALLER=$(grep "$i"-install-package $SUITE_INSTALL_DIR/"$i".sh)
if [ "$INSTALLER" != "" ]; then
if [ "$SUITESTATE" == "installed" ]; then
printf "\\e[1m\\e[32m%-20s\\e[0m %s\\n" "$i" "$(show-suite-info "$i")"
else
printf "\\e[1m%-20s\\e[0m %s\\n" "$i" "$(show-suite-info "$i")"
fi
fi
printf "\e[32m%-20s\e[0m %s\n" "$i$SUITESTATE" "$(show-suite-info "$i")"
done
echo -e "To view more info about a suite type: 'hassbian-config show \e[32msuite-name\e[0m'"
printf "\\n"
printf "Upgrade scripts: (Usage 'sudo hassbian-config upgrade \\e[1msuite\\e[0m')\\n"
for i in $installers
do
UPGRADE=$(grep "$i"-upgrade-package $SUITE_INSTALL_DIR/"$i".sh)
if [ "$UPGRADE" != "" ]; then
printf "\\e[1m%-20s\\e[0m %s\\n" "$i" "$(show-suite-info "$i")"
fi
done
printf "\\n"
printf "To view more info about a suite type: 'hassbian-config show \\e[1msuite\\e[0m\\n"
return 0
}

Expand Down

0 comments on commit bc642e9

Please sign in to comment.