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

Invalid parsing of an argument (not an option) that start with a dash ? #431

Open
fabd opened this issue Nov 15, 2022 · 1 comment
Open

Comments

@fabd
Copy link

fabd commented Nov 15, 2022

Hey there

I'm not sure if this is on my end or an actual issue ... this is the first time I'm using laravel zero.

It's really awesome and I quickly started making a simple CLI app that uses Youtube API.

So one of my commands has this at the beginning of the class:

class GetVideoCommand extends Command
{
  /**
   * The signature of the command.
   *
   * @var string
   */
  protected $signature = 'get-video
                            {id : the id of the video (required)}';

So if I do the following it works

./cliapp get-video MXDF0wVcWfA

However the following fails with a big red error message (turns out a lot of YouTube videoId's have a dash at the beginning):

./cliapp get-video -wPg1tNEWmo

The error message:

The "-w" option does not exist.

Unfortunately it seems the single or double quotes do not help:

./cliapp get-video '-wPg1tNEWmo'
./cliapp get-video "-wPg1tNEWmo"

Did I miss something obvious here?

@fabd fabd changed the title Invalid parsing of arguments that start with a dash ? Invalid parsing of an argument (not an option) that start with a dash ? Nov 15, 2022
@fabd
Copy link
Author

fabd commented Nov 21, 2022

Hmm after Google'in around I see it can work like this :

./cliapp get-video -- -wPg1tNEWmo

Fair enough although I'm not sure why quoting the 'argument' shouldn't work to escape the parsing of the dash but then again I am not a bash/shell script expert so there may be good reasons for it.

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

No branches or pull requests

1 participant