-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathTagIssue.php
More file actions
54 lines (42 loc) · 1.42 KB
/
Copy pathTagIssue.php
File metadata and controls
54 lines (42 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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();
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');
}
}