diff --git a/src/Commands/CommandCommand.php b/src/Commands/CommandCommand.php index 39b43aef..ff6fbeb6 100644 --- a/src/Commands/CommandCommand.php +++ b/src/Commands/CommandCommand.php @@ -38,7 +38,7 @@ public function handle() $command = $this->vapor->invoke( Manifest::id(), $environment = $this->argument('environment'), - $this->option('command') ?? Helpers::ask('What command would you like to execute') + $this->getCommand() ); Helpers::step('Executing Function...'.PHP_EOL); @@ -66,6 +66,16 @@ public function handle() Helpers::line('AWS Log Stream Name: '.$command['log_stream']); } + /** + * Get the command to run. + * + * @return string + */ + protected function getCommand() + { + return $this->option('command') ?? Helpers::ask('What command would you like to execute'); + } + /** * Wait for the given command to finish executing. * diff --git a/src/Commands/TinkerCommand.php b/src/Commands/TinkerCommand.php new file mode 100644 index 00000000..84493b09 --- /dev/null +++ b/src/Commands/TinkerCommand.php @@ -0,0 +1,37 @@ +setName('tinker') + ->addArgument('environment', InputArgument::OPTIONAL, 'The environment name', 'staging') + ->addOption('code', null, InputOption::VALUE_OPTIONAL, 'The code to execute with Tinker') + ->setDescription('Execute a code with Tinker'); + } + + /** + * Get the command to run. + * + * @return string + */ + protected function getCommand() + { + $code = $this->option('code') ?? Helpers::ask('What code would you like to execute'); + + return 'tinker --execute "'.$code.'"'; + } +} diff --git a/vapor b/vapor index eb8f391f..ce0f0878 100755 --- a/vapor +++ b/vapor @@ -165,6 +165,7 @@ $app->add(new Commands\UpCommand); // Commands / Invocations... $app->add(new Commands\CommandCommand); $app->add(new Commands\CommandLogCommand); +$app->add(new Commands\TinkerCommand); // Logs... $app->add(new Commands\TailCommand);