Skip to content

Commit

Permalink
Use laravel new Illuminate\Console\Concerns\HasParameters.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Feb 3, 2020
1 parent 4e9151b commit f52bfbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 49 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
}
},
"require": {
"illuminate/console": "^6.10",
"illuminate/filesystem": "^6.10"
"illuminate/console": "^6.14",
"illuminate/filesystem": "^6.14"
},
"require-dev": {
"mockery/mockery": "^1.3.1",
Expand Down
49 changes: 2 additions & 47 deletions src/Commands/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Orchestra\Canvas\Core\Commands;

use Illuminate\Console\Concerns\CallsCommands;
use Illuminate\Console\Concerns\HasParameters;
use Illuminate\Console\OutputStyle;
use Orchestra\Canvas\Core\Presets\Preset;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -11,6 +12,7 @@
abstract class Command extends \Symfony\Component\Console\Command\Command
{
use CallsCommands,
HasParameters,
Concerns\InteractionsWithIO;

/**
Expand Down Expand Up @@ -44,33 +46,6 @@ public function run(InputInterface $input, OutputInterface $output)
);
}

/**
* Specify the arguments and options on the command.
*
* @return void
*/
protected function specifyParameters()
{
// We will loop through all of the arguments and options for the command and
// set them all on the base command instance. This specifies what can get
// passed into these commands as "parameters" to control the execution.
foreach ($this->getArguments() as $arguments) {
if ($arguments instanceof InputArgument) {
$this->getDefinition()->addArgument($arguments);
} else {
\call_user_func_array([$this, 'addArgument'], $arguments);
}
}

foreach ($this->getOptions() as $options) {
if ($options instanceof InputOption) {
$this->getDefinition()->addOption($options);
} else {
\call_user_func_array([$this, 'addOption'], $options);
}
}
}

/**
* Resolve the console command instance for the given command.
*
Expand All @@ -82,24 +57,4 @@ protected function resolveCommand($command)
{
return $this->getApplication()->find($command);
}

/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [];
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [];
}
}

0 comments on commit f52bfbc

Please sign in to comment.