Skip to content

Commit

Permalink
add parameters to execute command
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Gaal committed Aug 11, 2022
1 parent 8191c32 commit aa673c2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/Commands/ExecuteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ExecuteCommand extends Command
{
protected $signature = 'execute {alias?}';
protected $signature = 'execute {alias?} {parameters?*}';

protected $description = 'Executes an alias.';

Expand All @@ -18,6 +18,7 @@ public function handle()
{
$alias = $this->argument('alias');
$quiet = $this->option('quiet') ?? false;
$parameters = $this->argument('parameters');

try {
$this->getProjectAliases();
Expand All @@ -37,6 +38,14 @@ public function handle()
}

foreach ($this->aliases[$alias] as $task) {
if ($parameters) {
$task = sprintf(
'%s %s',
$task,
implode(' ', $parameters)
);
}

if ($quiet) {
@shell_exec($task);
} else {
Expand Down

0 comments on commit aa673c2

Please sign in to comment.