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

Issue with space char into argument command #638

Closed
CapitaineCaverne opened this issue Nov 23, 2023 · 7 comments
Closed

Issue with space char into argument command #638

CapitaineCaverne opened this issue Nov 23, 2023 · 7 comments

Comments

@CapitaineCaverne
Copy link

CapitaineCaverne commented Nov 23, 2023

Sail Version

1.26.1

Laravel Version

10.33.1

PHP Version

8.2.12

Operating System

Windows (WSL)

OS Version

22

Description

When you call an artisan command with argument or option with a space char, only first word is transmited

Steps To Reproduce

namespace App\Console\Commands;

use Illuminate\Console\Command;

class MaCommande extends Command
{
    protected $signature = 'ma_commande {monArgument}';

    protected $description = 'Description de la commande.';

    public function handle()
    {
        $argument = $this->argument('monArgument');
    }
}
sail artisan ma_commande "Mon argument avec espace"

result

Too many arguments to "ma_commande" command, expected arguments "monArgument".
@driesvints
Copy link
Member

Try sail artisan ma_commande "Mon argument avec espace" ?

@CapitaineCaverne
Copy link
Author

CapitaineCaverne commented Nov 23, 2023

That is what I do, I've write a mistake in my comment.

This is working with php and not with sail.

@driesvints
Copy link
Member

Wondering if it's the _ char. If you rewrite the command name as macommande just to try it out, does it work then?

@CapitaineCaverne
Copy link
Author

Don't working:

<?php
namespace App\Console\Commands;

use Illuminate\Console\Command;

class ma extends Command
{
    protected $signature = 'ma {arg}';
    public function handle()
    {
        dd($this->arguments());
    }
}

sail artisan ma "foo bar"

Too many arguments to "ma" command, expected arguments "arg".

sail artisan ma "foobar"
array:2 [
"command" => "ma"
"arg" => "foobar"
] // app/Console/Commands/ma.php:11

@driesvints
Copy link
Member

I'm sorry but I don't know what the issue is then. Appreciating any insights if anyone could give them.

Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

@CapitaineCaverne
Copy link
Author

I've found the issue, sorry for disagreement.

That was my alias, I wrote

vendor/bin/sail $*

instead of

vendor/bin/sail "$@"

Ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants