]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Allow an unassigned flag to be passed to `arc tasks`
authorGareth Evans <gareth.evans@jdiuk.com>
Thu, 23 May 2013 17:32:41 +0000 (10:32 -0700)
committerepriestley <git@epriestley.com>
Thu, 23 May 2013 17:36:40 +0000 (10:36 -0700)
Summary: Returns unassigned tasks

Test Plan: Run `arc tasks`, `arc tasks --unassigned`, make sure I get the correct results

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T3201

Differential Revision: https://secure.phabricator.com/D6009

src/workflow/ArcanistTasksWorkflow.php

index c5a9de5706ed1b54395bd0ce71b82403a9e3a569..1e08a0d679e38c6e1732231ed20977807ca9086e 100644 (file)
@@ -52,6 +52,9 @@ EOTEXT
         'help' =>
           "Only show tasks assigned to the given username, ".
             "also accepts @all to show all, default is you.",
+        'conflict' => array(
+          "unassigned" => "--owner supresses unassigned",
+        ),
       ),
       'order' => array(
         'param' => 'task_order',
@@ -63,6 +66,9 @@ EOTEXT
         'param' => 'n',
         'paramtype' => 'int',
         'help' => "Limit the amount of tasks outputted, default is all.",
+      ),
+      'unassigned' => array(
+        'help' => "Only show tasks that are not assigned (upforgrabs).",
       )
     );
   }
@@ -70,13 +76,23 @@ EOTEXT
   public function run() {
     $output = array();
 
-    $status = $this->getArgument('status');
-    $owner = $this->getArgument('owner');
-    $order = $this->getArgument('order');
-    $limit = $this->getArgument('limit');
+    $status     = $this->getArgument('status');
+    $owner      = $this->getArgument('owner');
+    $order      = $this->getArgument('order');
+    $limit      = $this->getArgument('limit');
+    $unassigned = $this->getArgument('unassigned');
+
+    if ($owner) {
+      $ownerPHID = $this->findOwnerPhid($owner);
+    } elseif ($unassigned) {
+      $ownerPHID = null;
+    } else {
+      $ownerPHID = $this->getUserPHID();
+    }
+
     $this->tasks = $this->loadManiphestTasks(
       ($status == 'all' ? 'any' : $status),
-      ($owner ? $this->findOwnerPhid($owner) : $this->getUserPHID()),
+      $ownerPHID,
       $order,
       $limit);