From fe1a4ada0abb5e4bd99eb4e4b0d87906c00cdeec Mon Sep 17 00:00:00 2001 From: Roj Vroemen Date: Fri, 24 Jan 2025 16:45:36 +0100 Subject: [PATCH] Add `sail run` command (#770) * Add `sail run` command * Update sail --------- Co-authored-by: Taylor Otwell --- bin/sail | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/sail b/bin/sail index f8ba9f0f..1c1cf903 100755 --- a/bin/sail +++ b/bin/sail @@ -112,6 +112,7 @@ function display_help { echo echo "${YELLOW}Binaries:${NC}" echo " ${GREEN}sail bin ...${NC} Run Composer binary scripts from the vendor/bin directory" + echo " ${GREEN}sail run ...${NC} Run a command within the application container" echo echo "${YELLOW}Customization:${NC}" echo " ${GREEN}sail artisan sail:publish${NC} Publish the Sail configuration files" @@ -233,6 +234,20 @@ elif [ "$1" == "bin" ]; then sail_is_not_running fi +# Proxy commands on the application container... +elif [ "$1" == "run" ]; then + shift 1 + + if [ "$EXEC" == "yes" ]; then + CMD=$1 + shift 1 + ARGS+=(exec -u sail) + [ ! -t 0 ] && ARGS+=(-T) + ARGS+=("$APP_SERVICE" "$CMD") + else + sail_is_not_running + fi + # Proxy docker-compose commands to the docker-compose binary on the application container... elif [ "$1" == "docker-compose" ]; then shift 1