Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass all command line arguments to wrapped executable #728

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

JoaquinTrinanes
Copy link
Contributor

This PR makes sail <command> <args> always pass <args> to <command>.

Motivation

I found some discrepancies when using the tinker subcommand:

  • artisan tinker -h shows tinker's help
  • sail tinker -h directly enters the REPL

More specifically, my use case was to load a file that takes care of performing some initialization for me. Setting the current user, maybe assigning some variables that I'll need while testing things. But that doesn't work either:

echo '<?php throw new \Exception("File loaded");' > init.php

$ artisan tinker init.php
Psy Shell v0.12.3 (PHP 8.3.10 — cli) by Justin Hileman

   Exception  File loaded.

>

$ sail tinker init.php
Psy Shell v0.12.3 (PHP 8.3.10 — cli) by Justin Hileman
>

When looking at the sail script, I noticed that most commands forward $@, but tinker, mysql, mariadb, psql, redis, and open don't.

I believe this is confusing behavior, as it makes sail differ from how the actual underlying program works (like the tinker example). If a user passes an extra argument they probably do it for a reason, so with this change every argument is passed as-is.

@JoaquinTrinanes JoaquinTrinanes changed the title Pass all command line arguments wrapped executable Pass all command line arguments to wrapped executable Sep 16, 2024
@taylorotwell taylorotwell merged commit 2bc15bf into laravel:1.x Sep 16, 2024
9 checks passed
@JoaquinTrinanes JoaquinTrinanes deleted the pass-all-arguments branch September 16, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants