diff --git a/src/workflow/ArcanistTodoWorkflow.php b/src/workflow/ArcanistTodoWorkflow.php index 53aae0ed..30550e59 100644 --- a/src/workflow/ArcanistTodoWorkflow.php +++ b/src/workflow/ArcanistTodoWorkflow.php @@ -1,113 +1,121 @@ 'summary', 'cc' => array( 'param' => 'cc', 'short' => 'C', 'repeat' => true, 'help' => pht('Other users to CC on the new task.'), ), 'project' => array( 'param' => 'project', 'repeat' => true, 'help' => pht('Projects to assign to the task.'), ), + 'browse' => array( + 'help' => pht('After creating the task, open it in a web browser.'), + ), ); } public function run() { $summary = implode(' ', $this->getArgument('summary')); $ccs = $this->getArgument('cc'); $slugs = $this->getArgument('project'); $conduit = $this->getConduit(); if (trim($summary) == '') { echo "Please provide a summary.\n"; return; } $args = array( 'title' => $summary, 'ownerPHID' => $this->getUserPHID(), ); if ($ccs) { $phids = array(); $users = $conduit->callMethodSynchronous( 'user.query', array( 'usernames' => $ccs, )); foreach ($users as $user => $info) { $phids[] = $info['phid']; } $args['ccPHIDs'] = $phids; } if ($slugs) { $phids = array(); $projects = $conduit->callMethodSynchronous( 'project.query', array( 'slugs' => $slugs, )); foreach ($slugs as $slug) { $project = idx($projects['slugMap'], $slug); if (!$project) { throw new ArcanistUsageException('No such project: "'.$slug.'"'); } $phids[] = $project; } $args['projectPHIDs'] = $phids; } $result = $conduit->callMethodSynchronous('maniphest.createtask', $args); echo phutil_console_format( "Created task T%s: '**%s**' at **%s**\n", $result['id'], $result['title'], $result['uri']); + + if ($this->getArgument('browse')) { + $this->openURIsInBrowser(array($result['uri'])); + } + } }