diff --git a/src/workflow/ArcanistListWorkflow.php b/src/workflow/ArcanistListWorkflow.php --- a/src/workflow/ArcanistListWorkflow.php +++ b/src/workflow/ArcanistListWorkflow.php @@ -36,7 +36,21 @@ return true; } + public function getArguments() { + return array( + 'owner' => array( + 'param' => 'username', + 'paramtype' => 'username', + 'help' => pht( + 'Only show tasks assigned to the given username, '. + 'also accepts %s to show all, default is you.', + '@all'), + ), + ); + } + public function run() { + $owner = $this->getArgument('owner'); static $color_map = array( 'Closed' => 'cyan', 'Needs Review' => 'magenta', @@ -47,10 +61,17 @@ 'Abandoned' => 'default', ); + if ($owner) { + $owner_phid = $this->findOwnerPHID($owner); + } else { + $owner_phid = $this->getUserPHID(); + } + + $revisions = $this->getConduit()->callMethodSynchronous( 'differential.query', array( - 'authors' => array($this->getUserPHID()), + 'authors' => array($owner_phid), 'status' => 'status-open', )); @@ -106,4 +127,21 @@ return 0; } +private function findOwnerPHID($owner) { + $conduit = $this->getConduit(); + + $users = $conduit->callMethodSynchronous( + 'user.query', + array( + 'usernames' => array($owner), + )); + + if (!$users) { + return null; + } + + $user = head($users); + return idx($user, 'phid'); + } + }