-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added command to open d.org issue page for current feature branch.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Dorgflow\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Dorgflow\DependencyInjection\ContainerAwareTrait; | ||
use Dorgflow\Service\Analyser; | ||
|
||
/** | ||
* Opens the d.org issue page for the current feature branch. | ||
* | ||
* Expects the system to have an `open` command which supports URLs. | ||
*/ | ||
class OpenIssue extends Command { | ||
|
||
use ContainerAwareTrait; | ||
|
||
protected Analyser $analyser; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure() { | ||
$this | ||
->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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters