Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions bin/sail
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ function display_help {
echo
echo "${YELLOW}Container CLI:${NC}"
echo " ${GREEN}sail shell${NC} Start a shell session within the application container"
echo " ${GREEN}sail bash${NC} Alias for 'sail shell'"
echo " ${GREEN}sail bash${NC} Start a Bash session within the application container"
echo " ${GREEN}sail root-shell${NC} Start a root shell session within the application container"
echo " ${GREEN}sail root-bash${NC} Alias for 'sail root-shell'"
echo " ${GREEN}sail root-bash${NC} Start a root Bash session within the application container"
echo " ${GREEN}sail tinker${NC} Start a new Laravel Tinker session"
echo
echo "${YELLOW}Sharing:${NC}"
Expand Down Expand Up @@ -142,6 +142,7 @@ fi
export APP_PORT=${APP_PORT:-80}
export APP_SERVICE=${APP_SERVICE:-"laravel.test"}
export APP_USER=${APP_USER:-"sail"}
export APP_SHELL=${APP_SHELL:-"bash"}
export DB_PORT=${DB_PORT:-3306}
export WWWUSER=${WWWUSER:-$UID}
export WWWGROUP=${WWWGROUP:-$(id -g)}
Expand Down Expand Up @@ -520,8 +521,20 @@ elif [ "$1" == "psql" ]; then
sail_is_not_running
fi

# Initiate a default shell within the application container...
elif [ "$1" == "shell" ]; then
shift 1

if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u "$APP_USER")
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "$APP_SHELL")
else
sail_is_not_running
fi

# Initiate a Bash shell within the application container...
elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
elif [ "$1" == "bash" ]; then
shift 1

if [ "$EXEC" == "yes" ]; then
Expand All @@ -532,8 +545,20 @@ elif [ "$1" == "shell" ] || [ "$1" == "bash" ]; then
sail_is_not_running
fi

# Initiate a root user default shell within the application container...
elif [ "$1" == "root-shell" ]; then
shift 1

if [ "$EXEC" == "yes" ]; then
ARGS+=(exec -u root)
[ ! -t 0 ] && ARGS+=(-T)
ARGS+=("$APP_SERVICE" "$APP_SHELL")
else
sail_is_not_running
fi

# Initiate a root user Bash shell within the application container...
elif [ "$1" == "root-shell" ] || [ "$1" == "root-bash" ]; then
elif [ "$1" == "root-bash" ]; then
shift 1

if [ "$EXEC" == "yes" ]; then
Expand Down