Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10360317
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
15 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index 5d37794b..513df7fd 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1,191 +1,193 @@
<?php
/**
* This file is automatically generated. Use 'phutil_mapper.php' to rebuild it.
* @generated
*/
phutil_register_library_map(array(
'class' =>
array(
'ArcanistAliasWorkflow' => 'workflow/alias',
'ArcanistAmendWorkflow' => 'workflow/amend',
'ArcanistApacheLicenseLinter' => 'lint/linter/apachelicense',
'ArcanistApacheLicenseLinterTestCase' => 'lint/linter/apachelicense/__tests__',
'ArcanistBaseUnitTestEngine' => 'unit/engine/base',
'ArcanistBaseWorkflow' => 'workflow/base',
'ArcanistBranchWorkflow' => 'workflow/branch',
'ArcanistBundle' => 'parser/bundle',
'ArcanistBundleTestCase' => 'parser/bundle/__tests__',
'ArcanistCallConduitWorkflow' => 'workflow/call-conduit',
'ArcanistCapabilityNotSupportedException' => 'workflow/exception/notsupported',
'ArcanistChooseInvalidRevisionException' => 'exception',
'ArcanistChooseNoRevisionsException' => 'exception',
'ArcanistCommitWorkflow' => 'workflow/commit',
'ArcanistConduitLinter' => 'lint/linter/conduit',
'ArcanistConfiguration' => 'configuration',
'ArcanistCoverWorkflow' => 'workflow/cover',
'ArcanistDiffChange' => 'parser/diff/change',
'ArcanistDiffChangeType' => 'parser/diff/changetype',
'ArcanistDiffHunk' => 'parser/diff/hunk',
'ArcanistDiffParser' => 'parser/diff',
'ArcanistDiffParserTestCase' => 'parser/diff/__tests__',
'ArcanistDiffUtils' => 'difference',
'ArcanistDiffUtilsTestCase' => 'difference/__tests__',
'ArcanistDiffWorkflow' => 'workflow/diff',
'ArcanistDifferentialCommitMessage' => 'differential/commitmessage',
'ArcanistDifferentialCommitMessageParserException' => 'differential/commitmessage',
'ArcanistDifferentialRevisionHash' => 'differential/constants/revisionhash',
'ArcanistDifferentialRevisionStatus' => 'differential/constants/revisionstatus',
'ArcanistDownloadWorkflow' => 'workflow/download',
'ArcanistEventType' => 'events/constant/type',
'ArcanistExportWorkflow' => 'workflow/export',
'ArcanistFilenameLinter' => 'lint/linter/filename',
'ArcanistGeneratedLinter' => 'lint/linter/generated',
'ArcanistGitAPI' => 'repository/api/git',
'ArcanistGitHookPreReceiveWorkflow' => 'workflow/git-hook-pre-receive',
'ArcanistHelpWorkflow' => 'workflow/help',
'ArcanistHookAPI' => 'repository/hookapi/base',
'ArcanistInstallCertificateWorkflow' => 'workflow/install-certificate',
'ArcanistJSHintLinter' => 'lint/linter/jshint',
'ArcanistLandWorkflow' => 'workflow/land',
'ArcanistLiberateLintEngine' => 'lint/engine/liberate',
'ArcanistLiberateWorkflow' => 'workflow/liberate',
'ArcanistLicenseLinter' => 'lint/linter/license',
'ArcanistLintEngine' => 'lint/engine/base',
'ArcanistLintJSONRenderer' => 'lint/renderer',
'ArcanistLintLikeCompilerRenderer' => 'lint/renderer',
'ArcanistLintMessage' => 'lint/message',
'ArcanistLintPatcher' => 'lint/patcher',
'ArcanistLintRenderer' => 'lint/renderer',
'ArcanistLintResult' => 'lint/result',
'ArcanistLintSeverity' => 'lint/severity',
'ArcanistLintSummaryRenderer' => 'lint/renderer',
'ArcanistLintWorkflow' => 'workflow/lint',
'ArcanistLinter' => 'lint/linter/base',
'ArcanistLinterTestCase' => 'lint/linter/base/test',
'ArcanistListWorkflow' => 'workflow/list',
'ArcanistMarkCommittedWorkflow' => 'workflow/mark-committed',
'ArcanistMercurialAPI' => 'repository/api/mercurial',
'ArcanistMercurialParser' => 'repository/parser/mercurial',
'ArcanistMercurialParserTestCase' => 'repository/parser/mercurial/__tests__',
'ArcanistMergeWorkflow' => 'workflow/merge',
'ArcanistNoEffectException' => 'exception/usage/noeffect',
'ArcanistNoEngineException' => 'exception/usage/noengine',
'ArcanistNoLintLinter' => 'lint/linter/nolint',
'ArcanistNoLintTestCaseMisnamed' => 'lint/linter/nolint/__tests__',
'ArcanistPEP8Linter' => 'lint/linter/pep8',
'ArcanistPasteWorkflow' => 'workflow/paste',
'ArcanistPatchWorkflow' => 'workflow/patch',
'ArcanistPhutilModuleLinter' => 'lint/linter/phutilmodule',
'ArcanistPhutilTestCase' => 'unit/engine/phutil/testcase',
'ArcanistPhutilTestTerminatedException' => 'unit/engine/phutil/testcase/exception',
'ArcanistPyFlakesLinter' => 'lint/linter/pyflakes',
'ArcanistPyLintLinter' => 'lint/linter/pylint',
'ArcanistRepositoryAPI' => 'repository/api/base',
'ArcanistShellCompleteWorkflow' => 'workflow/shell-complete',
'ArcanistSpellingDefaultData' => 'lint/linter/spelling',
'ArcanistSpellingLinter' => 'lint/linter/spelling',
'ArcanistSpellingLinterTestCase' => 'lint/linter/spelling/__tests__',
'ArcanistSubversionAPI' => 'repository/api/subversion',
'ArcanistSubversionHookAPI' => 'repository/hookapi/subversion',
'ArcanistSvnHookPreCommitWorkflow' => 'workflow/svn-hook-pre-commit',
+ 'ArcanistTasksWorkflow' => 'workflow/tasks',
'ArcanistTextLinter' => 'lint/linter/text',
'ArcanistTextLinterTestCase' => 'lint/linter/text/__tests__',
'ArcanistUncommittedChangesException' => 'exception/usage/uncommittedchanges',
'ArcanistUnitTestResult' => 'unit/result',
'ArcanistUnitWorkflow' => 'workflow/unit',
'ArcanistUploadWorkflow' => 'workflow/upload',
'ArcanistUsageException' => 'exception/usage',
'ArcanistUserAbortException' => 'exception/usage/userabort',
'ArcanistWhichWorkflow' => 'workflow/which',
'ArcanistWorkingCopyIdentity' => 'workingcopyidentity',
'ArcanistXHPASTLintNamingHook' => 'lint/linter/xhpast/naminghook',
'ArcanistXHPASTLintNamingHookTestCase' => 'lint/linter/xhpast/naminghook/__tests__',
'ArcanistXHPASTLinter' => 'lint/linter/xhpast',
'ArcanistXHPASTLinterTestCase' => 'lint/linter/xhpast/__tests__',
'BranchInfo' => 'branch',
'ComprehensiveLintEngine' => 'lint/engine/comprehensive',
'ExampleLintEngine' => 'lint/engine/example',
'PhutilLintEngine' => 'lint/engine/phutil',
'PhutilModuleRequirements' => 'parser/phutilmodule',
'PhutilUnitTestEngine' => 'unit/engine/phutil',
'PhutilUnitTestEngineTestCase' => 'unit/engine/phutil/__tests__',
'UnitTestableArcanistLintEngine' => 'lint/engine/test',
),
'function' =>
array(
),
'requires_class' =>
array(
'ArcanistAliasWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistAmendWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistApacheLicenseLinter' => 'ArcanistLicenseLinter',
'ArcanistApacheLicenseLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistBranchWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistBundleTestCase' => 'ArcanistPhutilTestCase',
'ArcanistCallConduitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistCommitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistConduitLinter' => 'ArcanistLinter',
'ArcanistCoverWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistDiffParserTestCase' => 'ArcanistPhutilTestCase',
'ArcanistDiffUtilsTestCase' => 'ArcanistPhutilTestCase',
'ArcanistDiffWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistDownloadWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistEventType' => 'PhutilEventType',
'ArcanistExportWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistFilenameLinter' => 'ArcanistLinter',
'ArcanistGeneratedLinter' => 'ArcanistLinter',
'ArcanistGitAPI' => 'ArcanistRepositoryAPI',
'ArcanistGitHookPreReceiveWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistHelpWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistInstallCertificateWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistJSHintLinter' => 'ArcanistLinter',
'ArcanistLandWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistLiberateLintEngine' => 'ArcanistLintEngine',
'ArcanistLiberateWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistLicenseLinter' => 'ArcanistLinter',
'ArcanistLintWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistLinterTestCase' => 'ArcanistPhutilTestCase',
'ArcanistListWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistMarkCommittedWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
'ArcanistMercurialParserTestCase' => 'ArcanistPhutilTestCase',
'ArcanistMergeWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException',
'ArcanistNoLintLinter' => 'ArcanistLinter',
'ArcanistNoLintTestCaseMisnamed' => 'ArcanistLinterTestCase',
'ArcanistPEP8Linter' => 'ArcanistLinter',
'ArcanistPasteWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistPatchWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistPhutilModuleLinter' => 'ArcanistLinter',
'ArcanistPyFlakesLinter' => 'ArcanistLinter',
'ArcanistPyLintLinter' => 'ArcanistLinter',
'ArcanistShellCompleteWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistSpellingLinter' => 'ArcanistLinter',
'ArcanistSpellingLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistSubversionAPI' => 'ArcanistRepositoryAPI',
'ArcanistSubversionHookAPI' => 'ArcanistHookAPI',
'ArcanistSvnHookPreCommitWorkflow' => 'ArcanistBaseWorkflow',
+ 'ArcanistTasksWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistTextLinter' => 'ArcanistLinter',
'ArcanistTextLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistUncommittedChangesException' => 'ArcanistUsageException',
'ArcanistUnitWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistUploadWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistUserAbortException' => 'ArcanistUsageException',
'ArcanistWhichWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistXHPASTLintNamingHookTestCase' => 'ArcanistPhutilTestCase',
'ArcanistXHPASTLinter' => 'ArcanistLinter',
'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
'ComprehensiveLintEngine' => 'ArcanistLintEngine',
'ExampleLintEngine' => 'ArcanistLintEngine',
'PhutilLintEngine' => 'ArcanistLintEngine',
'PhutilUnitTestEngine' => 'ArcanistBaseUnitTestEngine',
'PhutilUnitTestEngineTestCase' => 'ArcanistPhutilTestCase',
'UnitTestableArcanistLintEngine' => 'ArcanistLintEngine',
),
'requires_interface' =>
array(
),
));
diff --git a/src/workflow/tasks/ArcanistTasksWorkflow.php b/src/workflow/tasks/ArcanistTasksWorkflow.php
new file mode 100644
index 00000000..bdf3d5ab
--- /dev/null
+++ b/src/workflow/tasks/ArcanistTasksWorkflow.php
@@ -0,0 +1,182 @@
+<?php
+
+/*
+ * Copyright 2012 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Displays User Tasks
+ *
+ * @group workflow
+ */
+final class ArcanistTasksWorkflow extends ArcanistBaseWorkflow {
+
+ private $tasks;
+
+ public function getCommandSynopses() {
+ return phutil_console_format(<<<EOTEXT
+ **tasks** [__options__]
+EOTEXT
+ );
+ }
+
+ public function getCommandHelp() {
+ return phutil_console_format(<<<EOTEXT
+ View all assigned tasks.
+EOTEXT
+ );
+ }
+
+ public function requiresConduit() {
+ return true;
+ }
+
+ public function requiresRepositoryAPI() {
+ return false;
+ }
+
+ public function requiresAuthentication() {
+ return true;
+ }
+
+
+ public function getArguments() {
+ return array(
+ 'status' => array(
+ 'param' => 'task_status',
+ 'help' => "Show tasks that or open or closed, default is all.",
+ ),
+ 'owner' => array(
+ 'param' => 'username',
+ 'paramtype' => 'username',
+ 'help' =>
+ "Only show tasks assigned to the given username, ".
+ "also accepts @all to show all, default is you.",
+ ),
+ 'order' => array(
+ 'param' => 'task_order',
+ 'help' =>
+ "Arrange tasks based on priority, created, or modified, ".
+ "default is priority.",
+ ),
+ 'limit' => array(
+ 'param' => 'n',
+ 'paramtype' => 'int',
+ 'help' => "Limit the amount of tasks outputted, default is all.",
+ )
+ );
+ }
+
+ public function run() {
+ $output = array();
+
+ $status = $this->getArgument('status');
+ $owner = $this->getArgument('owner');
+ $order = $this->getArgument('order');
+ $limit = $this->getArgument('limit');
+ $this->tasks = $this->loadManiphestTasks(
+ ($status == 'all'?'any':$status),
+ ($owner?$this->findOwnerPhid($owner):$this->getUserPHID()),
+ $order,
+ $limit
+ );
+
+ foreach ($this->tasks as $task) {
+ $tid = "T{$task['id']}";
+ switch ($task['priority']) {
+ case 'Needs Triage':
+ $color = 'magenta';
+ break;
+ case 'Unbreak Now!':
+ $color = 'red';
+ break;
+ case 'High':
+ $color = 'yellow';
+ break;
+ case 'Normal':
+ $color = 'green';
+ break;
+ case 'Low':
+ $color = 'blue';
+ break;
+ case 'Wishlist':
+ $color = 'cyan';
+ break;
+ default:
+ $color = 'white';
+ break;
+ }
+ $task_priority = $task['priority'];
+ $priority = phutil_console_format("<bg:{$color}> </bg>{$task_priority}");
+ $output[] = array(phutil_console_format("**{$tid}**"),
+ $task['title'],
+ $priority,
+ ($task['status']?
+ phutil_console_format("<bg:red> </bg>Closed"):
+ phutil_console_format('<bg:green> </bg>Open'))
+ );
+ }
+ $this->render($output);
+ }
+
+ private function render($table) {
+ $column_length = array();
+ foreach ($table as $row) {
+ foreach ($row as $col => $cell) {
+ if (!isset($column_length[$col]))
+ $column_length[$col] = 0;
+ if (strlen($cell) > $column_length[$col])
+ $column_length[$col] = strlen($cell);
+ }
+ }
+ foreach ($table as $row) {
+ foreach ($row as $col => $cell) {
+ echo $cell.str_repeat(' ', $column_length[$col] - strlen($cell) + 4);
+ }
+ echo "\n";
+ }
+ }
+
+ private function findOwnerPhid($owner) {
+ $conduit = $this->getConduit();
+ $owner_phid = $conduit->callMethodSynchronous(
+ 'user.find',
+ array(
+ 'aliases' => array($owner),
+ ));
+ return (isset($owner_phid[$owner])?$owner_phid[$owner]:false);
+ }
+
+ private function loadManiphestTasks($status, $owner_phid, $order, $limit) {
+ $conduit = $this->getConduit();
+
+ $find_params = array();
+ if ($owner_phid !== false) {
+ $find_params['ownerPHIDs'] = array($owner_phid);
+ }
+ if ($limit !== false) {
+ $find_params['limit'] = $limit;
+ }
+ $find_params['order'] = ($order?"order-".$order:"order-priority");
+ $find_params['status'] = ($status?"status-".$status:"status-open");
+
+ $tasks = $conduit->callMethodSynchronous(
+ 'maniphest.find',
+ $find_params
+ );
+ return $tasks;
+ }
+
+}
diff --git a/src/workflow/tasks/__init__.php b/src/workflow/tasks/__init__.php
new file mode 100644
index 00000000..49517604
--- /dev/null
+++ b/src/workflow/tasks/__init__.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * This file is automatically generated. Lint this module to rebuild it.
+ * @generated
+ */
+
+
+
+phutil_require_module('arcanist', 'workflow/base');
+
+phutil_require_module('phutil', 'console');
+
+
+phutil_require_source('ArcanistTasksWorkflow.php');
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 8, 06:25 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034098
Default Alt Text
(15 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment