Skip to content
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ You need to specify `--url` for the first time, url and optionally login credent
$ eventum.phar --url=http://eventum.example.org wr
Authentication required (http://eventum.example.org/rpc/xmlrpc.php):
Username: glen
Password:
Password:
Do you want to store credentials for http://eventum.example.org/rpc/xmlrpc.php ? [Yn] y
Elan Ruusamäe Weekly Report 2015.04.27 - 2015.05.03
```


## Commands ##

Available commands:
- **add-attachment** Add attachment to issue
- **open-issues** List open issues
- **view-issue** Display Issue details
- **weekly-report**, **wr** Show weekly reports
- **set-status**, **ss** Set Issue status
1 change: 1 addition & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ protected function getDefaultCommands()
$commands[] = new Command\DumpMethodsCommand();
$commands[] = new Command\ConfigCommand();
$commands[] = new Command\AddTimeEntryCommand();
$commands[] = new Command\SetIssueStatusCommand();

if ('phar:' === substr(__FILE__, 0, 5)) {
$commands[] = new Command\SelfUpdateCommand();
Expand Down
52 changes: 52 additions & 0 deletions src/Command/SetIssueStatusCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace Eventum\Console\Command;

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

class SetIssueStatusCommand extends Command
{
protected function configure()
{
$this
->setName('set-status')
->setAliases(array('ss'))
->setDescription('Set Issue status')
->addArgument(
'issue_id',
InputArgument::REQUIRED,
'Issue id'
)
->addArgument(
'status',
InputArgument::REQUIRED,
'New status for issue'
)
->setHelp(
<<<EOT
<info>%command.full_name% 123 new</info>

Set issue status.
EOT
);
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$issue_id = (int )$input->getArgument('issue_id');
$new_status = $input->getArgument('status');
$client = $this->getClient();

$result = $client->setIssueStatus($issue_id, $new_status);
if ($result == 'OK') {
$message = "Status changed to '<info>$new_status</info>' on issue #$issue_id";
$output->writeln($message);
return 0;
} else {
$output->writeln("<error>$result</error>");
return 1;
}
}
}