Page MenuHomePhabricator

D9265.id22006.diff
No OneTemporary

D9265.id22006.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -172,6 +172,7 @@
'ArcanistUploadWorkflow' => 'workflow/ArcanistUploadWorkflow.php',
'ArcanistUsageException' => 'exception/ArcanistUsageException.php',
'ArcanistUserAbortException' => 'exception/usage/ArcanistUserAbortException.php',
+ 'ArcanistVersionWorkflow' => 'workflow/ArcanistVersionWorkflow.php',
'ArcanistWhichWorkflow' => 'workflow/ArcanistWhichWorkflow.php',
'ArcanistWorkingCopyIdentity' => 'workingcopyidentity/ArcanistWorkingCopyIdentity.php',
'ArcanistXHPASTLintNamingHook' => 'lint/linter/xhpast/ArcanistXHPASTLintNamingHook.php',
@@ -333,6 +334,7 @@
'ArcanistUploadWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistUsageException' => 'Exception',
'ArcanistUserAbortException' => 'ArcanistUsageException',
+ 'ArcanistVersionWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistWhichWorkflow' => 'ArcanistBaseWorkflow',
'ArcanistXHPASTLintNamingHookTestCase' => 'ArcanistTestCase',
'ArcanistXHPASTLintTestSwitchHook' => 'ArcanistXHPASTLintSwitchHook',
diff --git a/src/workflow/ArcanistVersionWorkflow.php b/src/workflow/ArcanistVersionWorkflow.php
new file mode 100644
--- /dev/null
+++ b/src/workflow/ArcanistVersionWorkflow.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Display the current version of Arcanist.
+ */
+final class ArcanistVersionWorkflow extends ArcanistBaseWorkflow {
+
+ public function getWorkflowName() {
+ return 'version';
+ }
+
+ public function getCommandSynopses() {
+ return phutil_console_format(<<<EOTEXT
+ **version** [__options__]
+EOTEXT
+ );
+ }
+
+ public function getCommandHelp() {
+ return phutil_console_format(pht(<<<EOTEXT
+ Supports: cli
+ Shows the current version of arcanist.
+EOTEXT
+ ));
+ }
+
+ public function run() {
+ $console = PhutilConsole::getConsole();
+
+ $roots = array(
+ 'arcanist' => dirname(phutil_get_library_root('arcanist')),
+ 'libphutil' => dirname(phutil_get_library_root('phutil')),
+ );
+
+ foreach ($roots as $lib => $root) {
+ $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root);
+
+ $configuration_manager = clone $this->getConfigurationManager();
+ $configuration_manager->setWorkingCopyIdentity($working_copy);
+ $repository_api = ArcanistRepositoryAPI::newAPIFromConfigurationManager(
+ $configuration_manager);
+
+ $this->setRepositoryAPI($repository_api);
+ $console->writeOut("%s %s (%s)\n",
+ $lib,
+ $repository_api->getWorkingCopyRevision(),
+ date('j M Y', $repository_api->getWorkingCopyTimestamp()));
+ }
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 7:26 PM (11 h, 14 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715924
Default Alt Text
D9265.id22006.diff (2 KB)

Event Timeline