Skip to content

Commit

Permalink
General improvements (thedevdojo#42)
Browse files Browse the repository at this point in the history
* Show help when no arguments supplied

* Add .editorconfig

* Add `enter` command

* Normalize formatting according to .editorconfig

Simply re-saved all files with .editorconfig formatting

* Update color printing

This fixes color printing with nested commands
(for instance calling `host` from `new` command)
  • Loading branch information
lexuzieel authored Oct 12, 2020
1 parent a82f11c commit 3fb6dc9
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 41 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
16 changes: 16 additions & 0 deletions .larasail/enter
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

#/
#--------------------------------------------------------------------------
# Larasail Environment Launcher
#--------------------------------------------------------------------------
#
# Enter shell as larasail user
#
#/

if [ "$(whoami)" != "larasail" ]; then
sudo su - larasail
else
echo "Already logged in as larasail"
fi
4 changes: 2 additions & 2 deletions .larasail/host
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This command will create a new nginx host file for a specific domain
# pass the website domain and the folder location, here's an example:
#
#
# $ larasail host mywebsite.com /var/www/mywebsite
#
# The above command will create a new nginx host that will listen
Expand Down Expand Up @@ -120,7 +120,7 @@ if ! echo "server {
location ~ /\.ht {
deny all;
}
}" > $sitesAvailable$configName
then
echo "There is an ERROR create $configName file"
Expand Down
64 changes: 32 additions & 32 deletions .larasail/includes/colors
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@ Cyan="\033[36m" # Cyan
White="\033[37m" # White

black(){
echo "${Black}$1${Color_Off}"
printf "${Black}$1${Color_Off}\n"
}

red(){
echo "${Red}$1${Color_Off}"
printf "${Red}$1${Color_Off}\n"
}

green(){
echo "${Green}$1${Color_Off}"
printf "${Green}$1${Color_Off}\n"
}

yellow(){
echo "${Yellow}$1${Color_Off}"
printf "${Yellow}$1${Color_Off}\n"
}

blue(){
echo "${Blue}$1${Color_Off}"
printf "${Blue}$1${Color_Off}\n"
}

purple(){
echo "${Purple}$1${Color_Off}"
printf "${Purple}$1${Color_Off}\n"
}

cyan(){
echo "${Cyan}$1${Color_Off}"
printf "${Cyan}$1${Color_Off}\n"
}

white(){
echo "${White}$1${Color_Off}"
printf "${White}$1${Color_Off}\n"
}

# Bold
Expand All @@ -56,35 +56,35 @@ BCyan="\033[1;36m" # Cyan
BWhite="\033[1;37m" # White

blackb(){
echo "${BBlack}$1${Color_Off}"
printf "${BBlack}$1${Color_Off}\n"
}

redb(){
echo "${BRed}$1${Color_Off}"
printf "${BRed}$1${Color_Off}\n"
}

greenb(){
echo "${BGreen}$1${Color_Off}"
printf "${BGreen}$1${Color_Off}\n"
}

yellowb(){
echo "${BYellow}$1${Color_Off}"
printf "${BYellow}$1${Color_Off}\n"
}

blueb(){
echo "${BBlue}$1${Color_Off}"
printf "${BBlue}$1${Color_Off}\n"
}

purpleb(){
echo "${BPurple}$1${Color_Off}"
printf "${BPurple}$1${Color_Off}\n"
}

cyanb(){
echo "${BCyan}$1${Color_Off}"
printf "${BCyan}$1${Color_Off}\n"
}

whiteb(){
echo "${BWhite}$1${Color_Off}"
printf "${BWhite}$1${Color_Off}\n"
}

# Underline
Expand All @@ -98,35 +98,35 @@ UCyan="\e[4;36m" # Cyan
UWhite="\e[4;37m" # White

blacku(){
echo "${UBlack}$1${Color_Off}"
printf "${UBlack}$1${Color_Off}\n"
}

redu(){
echo "${URed}$1${Color_Off}"
printf "${URed}$1${Color_Off}\n"
}

greenu(){
echo "${UGreen}$1${Color_Off}"
printf "${UGreen}$1${Color_Off}\n"
}

yellowu(){
echo "${UYellow}$1${Color_Off}"
printf "${UYellow}$1${Color_Off}\n"
}

blueu(){
echo "${UBlue}$1${Color_Off}"
printf "${UBlue}$1${Color_Off}\n"
}

purpleu(){
echo "${UPurple}$1${Color_Off}"
printf "${UPurple}$1${Color_Off}\n"
}

cyanu(){
echo "${UCyan}$1${Color_Off}"
printf "${UCyan}$1${Color_Off}\n"
}

whiteu(){
echo "${UWhite}$1${Color_Off}"
printf "${UWhite}$1${Color_Off}\n"
}

# Background
Expand All @@ -140,34 +140,34 @@ On_Cyan="\033[46m" # Cyan
On_White="\033[47m" # White

blackbg(){
echo "${On_Black}$1${Color_Off}"
printf "${On_Black}$1${Color_Off}\n"
}

redbg(){
echo "${On_Red}$1${Color_Off}"
printf "${On_Red}$1${Color_Off}\n"
}

greenbg(){
echo "${On_Green}$1${Color_Off}"
printf "${On_Green}$1${Color_Off}\n"
}

yellowbg(){
echo "${On_Yellow}$1${Color_Off}"
printf "${On_Yellow}$1${Color_Off}\n"
}

bluebg(){
echo "${On_Blue}$1${Color_Off}"
printf "${On_Blue}$1${Color_Off}\n"
}

purplebg(){
echo "${On_Purple}$1${Color_Off}"
printf "${On_Purple}$1${Color_Off}\n"
}

cyanbg(){
echo "${On_Cyan}$1${Color_Off}"
printf "${On_Cyan}$1${Color_Off}\n"
}

whitebg(){
echo "${On_White}$1${Color_Off}"
printf "${On_White}$1${Color_Off}\n"
}

2 changes: 1 addition & 1 deletion .larasail/includes/format
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ setsailNoColor(){
echo " _!__!__!_ "
echo " \_______/ "
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
}
}
1 change: 1 addition & 0 deletions .larasail/includes/help
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ echo " larasail $arguments"
echo ""

echo "${Yellow}Arguments:${Color_Off}"
echo " ${Yellow}enter${Color_Off} Enter shell as larasail user"
echo " ${Yellow}setup${Color_Off} Setup a new server with Nginx, PHP 7.4, and MySQL 5.7"
echo " ${Yellow}setup php73${Color_Off} Setup a new server with Nginx, PHP 7.3, and MySQL 5.7"
echo " ${Yellow}setup php72${Color_Off} Setup a new server with Nginx, PHP 7.2, and MySQL 5.7"
Expand Down
4 changes: 2 additions & 2 deletions .larasail/larasail
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#
#/

if [ "$1" = "-h" ]
if [ "$1" = "-h" ] || [ -z $1 ]
then
. /etc/.larasail/includes/help
elif [ "$1" = "host" ] ; then
sudo sh /etc/.larasail/$1 $2 $3
else
. /etc/.larasail/$1 $2 $3
fi
fi
2 changes: 1 addition & 1 deletion .larasail/mysqlpass
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ MYSQLPASS=$(cat /etc/.larasail/tmp/mysqlpass)
bar
cyan "| MySQL Password:"
cyan "| $MYSQLPASS"
bar
bar
2 changes: 1 addition & 1 deletion .larasail/pass
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ PASS=$(cat /etc/.larasail/tmp/pass)
bar
cyan "| LaraSail User Password:"
cyan "| $PASS"
bar
bar
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ In the event that you have a issue using the tool or have a suggest for a change
we are more than happy to help.
Make sure that when you create your issue, it follows the format for the type of issue you select
(it has individual templates for each issue type).

Issue template types include the following:
- Bug Reporting
- Feature Requests
- Help Requests
- Help Requests

0 comments on commit 3fb6dc9

Please sign in to comment.