diff --git a/Command/OpenIssue.php b/Command/OpenIssue.php new file mode 100644 index 0000000..e922d30 --- /dev/null +++ b/Command/OpenIssue.php @@ -0,0 +1,49 @@ +setName('open') + ->setDescription('Opens the issue for the current feature branch.') + ->setHelp('Uses the system `open` command to open the issue for the current feature branch in the default browser.'); + } + + protected function setServices() { + $this->analyser = $this->container->get('analyser'); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output): int { + $this->setServices(); + + $issue_number = $this->analyser->deduceIssueNumber(); + + exec('open https://www.drupal.org/node/' . $issue_number); + + return 0; + } + +} diff --git a/dorgflow b/dorgflow index b1e39e9..b043983 100755 --- a/dorgflow +++ b/dorgflow @@ -21,6 +21,7 @@ $application->add($container->get('command.apply')); $application->add($container->get('command.cleanup')); $application->add($container->get('command.patch')); $application->add($container->get('command.status')); +$application->add($container->get('command.open')); $application->add($container->get('command.diff')); $application->add($container->get('command.setup')); $application->add($container->get('command.update')); diff --git a/services.php b/services.php index cccbb2c..ca99e86 100644 --- a/services.php +++ b/services.php @@ -61,6 +61,9 @@ $container ->register('command.status', \Dorgflow\Command\Status::class) ->addMethodCall('setContainer', [new Reference('service_container')]); +$container + ->register('command.open', \Dorgflow\Command\OpenIssue::class) + ->addMethodCall('setContainer', [new Reference('service_container')]); $container ->register('command.diff', \Dorgflow\Command\Diff::class) ->addMethodCall('setContainer', [new Reference('service_container')]);