This is an alias (with typings) of Laravel Sail for NuShell.
- place the file in a config directory of choice (i.e.,
~/.config/nushell) - source the file in
config.nu:source ~/.config/nushell/sail.nu
This is an alias (with typings) of Laravel Sail for NuShell.
~/.config/nushell)config.nu:
source ~/.config/nushell/sail.nu
| def run_sail [...rest] { | |
| if (not ("./vendor/bin/sail" | path exists)) { | |
| error make { | |
| msg: "Unable to find Sail" | |
| } | |
| } | |
| /usr/bin/env sh -c $"./vendor/bin/sail ($rest | flatten | str join ' ')" | |
| } | |
| export def "sail up" [ | |
| -d # Run in background | |
| ] { | |
| match $d { | |
| true => { run_sail up '-d' } | |
| _ => { run_sail up } | |
| } | |
| } | |
| # Stop the application | |
| export def "sail stop" [] { | |
| run_sail stop | |
| } | |
| # Restart the application | |
| export def "sail restart" [] { | |
| run_sail restart | |
| } | |
| # Display the status of all containers | |
| export def "sail ps" [] { | |
| run_sail ps | from ssv | |
| } | |
| # Run an Artisan command | |
| export def "sail artisan" [...args:string] { | |
| run_sail artisan $args | |
| } | |
| # Run a snippet of PHP code | |
| export def "sail php" [...args:string] { | |
| run_sail php $args | |
| } | |
| # Run a Composer command | |
| export def "sail composer" [...args:string] { | |
| run_sail composer $args | |
| } | |
| # Run a Node command | |
| export def "sail node" [...args:string] { | |
| run_sail node $args | |
| } | |
| # Run a npm command | |
| export def "sail npm" [...args:string] { | |
| run_sail npm $args | |
| } | |
| # Run a npx command | |
| export def "sail npx" [...args:string] { | |
| run_sail npx ($args | str join " ") | |
| } | |
| # Run a yarn command | |
| export def "sail yarn" [...args:string] { | |
| run_sail yarn $args | |
| } | |
| # Start a MySQL CLI session within the 'mysql' container | |
| export def "sail mysql" [] { | |
| run_sail mysql | |
| } | |
| # Start a MySQL CLI session within the 'mariadb' container | |
| export def "sail mariadb" [] { | |
| run_sail mariadb | |
| } | |
| # Start a PostgreSQL CLI session within the 'pgsql' container | |
| export def "sail psql" [] { | |
| run_sail psql | |
| } | |
| # Start a Redis CLI session within the 'redis' container | |
| export def "sail redis" [] { | |
| run_sail redis | |
| } | |
| # Run an Artisan command in debug mode | |
| export def "sail debug" [...args:string] { | |
| run_sail debug $args | |
| } | |
| # Run the PHPUnit tests via the Artisan test command | |
| export def "sail test" [...args:string] { | |
| run_sail test $args | |
| } | |
| # Run PHPUnit | |
| export def "sail phpunit" [...args:string] { | |
| run_sail phpunit $args | |
| } | |
| # Run Pest | |
| export def "sail pest" [...args:string] { | |
| run_sail pest $args | |
| } | |
| # Run Pint | |
| export def "sail pint" [...args:string] { | |
| run_sail pint $args | |
| } | |
| # Run the Dusk tests (Requires the laravel/dusk package) | |
| export def "sail dusk" [...args:string] { | |
| run_sail dusk $args | |
| } | |
| # Re-run previously failed Dusk tests (Requires the laravel/dusk package) | |
| export def "sail dusk:fails" [...args:string] { | |
| run_sail dusk:fails $args | |
| } | |
| # Start a shell session within the application container | |
| export def "sail shell" [...args:string] { | |
| run_sail shell $args | |
| } | |
| # Alias for 'sail shell' | |
| export def "sail bash" [...args:string] { | |
| run_sail bash $args | |
| } | |
| # Start a root shell session within the application container | |
| export def "sail root-shell" [...args:string] { | |
| run_sail root-shell $args | |
| } | |
| # Alias for 'sail root-shell' | |
| export def "sail root-bash" [...args:string] { | |
| run_sail root-bash $args | |
| } | |
| # Start a new Laravel Tinker session | |
| export def "sail tinker" [...args:string] { | |
| run_sail tinker $args | |
| } | |
| # Share the application publicly via a temporary URL | |
| export def "sail share" [...args:string] { | |
| run_sail share $args | |
| } | |
| # Open the site in your browser | |
| export def "sail open" [...args:string] { | |
| run_sail open $args | |
| } | |
| # Run Composer binary scripts from the vendor/bin directory | |
| export def "sail bin" [...args:string] { | |
| run_sail bin $args | |
| } | |
| # Publish the Sail configuration files | |
| export def "sail artisan sail:publish" [...args:string] { | |
| run_sail artisan sail:publish $args | |
| } | |
| # Rebuild all of the Sail containers | |
| export def "sail build" [--no-cache: bool] { | |
| match $no_cache { | |
| true => { run_sail build "--no-cache" } | |
| _ => { run_sail build } | |
| } | |
| } | |
| alias sail = run_sail |