4
* Quickly create a task.
6
final class ArcanistTodoWorkflow extends ArcanistWorkflow {
8
public function getWorkflowName() {
12
public function getCommandSynopses() {
13
return phutil_console_format(<<<EOTEXT
14
**todo** __summary__ [__options__]
19
public function getCommandHelp() {
20
return phutil_console_format(<<<EOTEXT
21
Quickly create a task for yourself.
26
public function requiresConduit() {
30
public function desiresWorkingCopy() {
34
public function requiresAuthentication() {
38
public function getArguments() {
45
'help' => pht('Other users to CC on the new task.'),
50
'help' => pht('Projects to assign to the task.'),
53
'help' => pht('After creating the task, open it in a web browser.'),
58
public function run() {
59
$summary = implode(' ', $this->getArgument('summary'));
60
$ccs = $this->getArgument('cc');
61
$slugs = $this->getArgument('project');
63
$conduit = $this->getConduit();
65
if (trim($summary) == '') {
66
echo "Please provide a summary.\n";
72
'ownerPHID' => $this->getUserPHID(),
77
$users = $conduit->callMethodSynchronous(
82
foreach ($users as $user => $info) {
83
$phids[] = $info['phid'];
85
$args['ccPHIDs'] = $phids;
90
$projects = $conduit->callMethodSynchronous(
96
foreach ($slugs as $slug) {
97
$project = idx($projects['slugMap'], $slug);
100
throw new ArcanistUsageException('No such project: "'.$slug.'"');
105
$args['projectPHIDs'] = $phids;
108
$result = $conduit->callMethodSynchronous('maniphest.createtask', $args);
109
echo phutil_console_format(
110
"Created task T%s: '<fg:green>**%s**</fg>' at <fg:blue>**%s**</fg>\n",
115
if ($this->getArgument('browse')) {
116
$this->openURIsInBrowser(array($result['uri']));