Framework: php artisan Option Shortcuts issue `The "--L" option does not exist.`

Created on 14 Jun 2017  路  7Comments  路  Source: laravel/framework

  • Laravel Version: 5.4.23
  • PHP Version: 7.1.4
  • Database Driver & Version: MySQL 5.7

Description:

When I use Option Shortcuts in my artisan console $signature锛宨t tips like below

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class BaiduPush extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'baidu:push {id?} {--L|limit=2000}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Push the url to Baidu Webmaster';


    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        dd($this->options());
    }
}

run php artisan baidu:push --L=2000, output:

[Symfony\Component\Console\Exception\RuntimeException]
  The "--L" option does not exist.

but the offical document show this method
link https://laravel.com/docs/5.4/artisan#registering-commands (see section Option Shortcuts )

Steps To Reproduce:

Most helpful comment

Looks like people are supposed to know everything about Symfony Console while reading docs about Artisan

All 7 comments

should be php artisan baidu:push -L=2000

@themsaid
Thank you very much.
-L=2000 not --L=2000, now its work now.
but the official documentation does not mention that.
Hope will be mentioned in the official documentation

@fbens it won't be mentioned unless you make PR to docs next time.

Actually it won't be mentioned anyway :D

Looks like people are supposed to know everything about Symfony Console while reading docs about Artisan

Yes, same with: php artisan migrate -鈥揹atabase=sqlite_testing

No need for '=' sign in the option values either, they will get included in $this->option('key'). I would use the following:

php artisan baidu:push -L 2000

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felixsanz picture felixsanz  路  3Comments

PhiloNL picture PhiloNL  路  3Comments

kerbylav picture kerbylav  路  3Comments

RomainSauvaire picture RomainSauvaire  路  3Comments

CupOfTea696 picture CupOfTea696  路  3Comments