Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dop
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use DrupalPatchUtils\Command\Logout;
use DrupalPatchUtils\Command\PostComment;
use DrupalPatchUtils\Command\SearchIssuePatch;
use DrupalPatchUtils\Command\SearchRtbcPatches;
use DrupalPatchUtils\Command\TagIssue;
use DrupalPatchUtils\Command\ValidatePatch;
use DrupalPatchUtils\Command\ValidateRtbcPatches;
use Symfony\Component\Console\Application;
Expand All @@ -23,6 +24,7 @@ $application->add(new SearchIssuePatch());
$application->add(new SearchRtbcPatches());
$application->add(new ValidatePatch());
$application->add(new ValidateRtbcPatches());
$application->add(new TagIssue());
$application->add(new Login());
$application->add(new Logout());
$application->run();
54 changes: 54 additions & 0 deletions src/DrupalPatchUtils/Command/TagIssue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/**
* @file
* Contains DrupalPatchUtils\Command\TagIssue.
*/

namespace DrupalPatchUtils\Command;


use DrupalPatchUtils\DoBrowser;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class TagIssue extends CommandBase {

protected function configure()
{
$this
->setName('tagIssue')
->setAliases(array('ti'))
->setDescription('Add a tag to an existing issue')
->addArgument(
'url',
InputArgument::REQUIRED,
'What is the url of the issue to retrieve?'
)
->addArgument(
'tag',
InputArgument::REQUIRED,
'The new tag'
);
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$issue = $this->getIssue($input->getArgument('url'));

$browser = new DoBrowser();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->login() :)

if (!$browser->loggedIn()) {
$browser->login($this->getConfig()->getDrupalUser(), $this->ask($output, "Enter your Drupal.org password: ", '', TRUE));
}

$comment_form = $browser->getCommentForm($issue->getUri());

$comment_form->setCommentText('Add tag');
$comment_form->ensureTag($input->getArgument('tag'));

$browser->submitForm($comment_form->getForm());
$output->writeln('Added tag');
}

}