Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15395654
D21001.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D21001.id.diff
View Options
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
@@ -966,7 +966,7 @@
'ArcanistAliasWorkflow' => 'ArcanistWorkflow',
'ArcanistAliasesConfigOption' => 'ArcanistListConfigOption',
'ArcanistAmendWorkflow' => 'ArcanistWorkflow',
- 'ArcanistAnoidWorkflow' => 'ArcanistWorkflow',
+ 'ArcanistAnoidWorkflow' => 'ArcanistArcWorkflow',
'ArcanistArcConfigurationEngineExtension' => 'ArcanistConfigurationEngineExtension',
'ArcanistArcToolset' => 'ArcanistToolset',
'ArcanistArcWorkflow' => 'ArcanistWorkflow',
@@ -1410,7 +1410,7 @@
'ArcanistVariableVariableXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
'ArcanistVariableVariableXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistVersionWorkflow' => 'ArcanistWorkflow',
- 'ArcanistWeldWorkflow' => 'ArcanistWorkflow',
+ 'ArcanistWeldWorkflow' => 'ArcanistArcWorkflow',
'ArcanistWhichWorkflow' => 'ArcanistWorkflow',
'ArcanistWildConfigOption' => 'ArcanistConfigOption',
'ArcanistWorkflow' => 'Phobject',
diff --git a/src/runtime/ArcanistRuntime.php b/src/runtime/ArcanistRuntime.php
--- a/src/runtime/ArcanistRuntime.php
+++ b/src/runtime/ArcanistRuntime.php
@@ -139,11 +139,14 @@
try {
return $args->parseWorkflowsFull($phutil_workflows);
} catch (PhutilArgumentUsageException $usage_exception) {
- $log->writeHint(
- pht('(::)'),
- pht(
- 'Workflow is unrecognized by modern "arc", falling through '.
- 'to classic mode.'));
+
+ // TODO: This is very, very hacky; we're trying to let errors like
+ // "you passed the wrong arguments" through but fall back to classic
+ // mode if the workflow itself doesn't exist.
+ if (!preg_match('/invalid command/i', $usage_exception->getMessage())) {
+ throw $usage_exception;
+ }
+
}
$arcanist_root = phutil_get_library_root('arcanist');
diff --git a/src/toolset/ArcanistWorkflowInformation.php b/src/toolset/ArcanistWorkflowInformation.php
--- a/src/toolset/ArcanistWorkflowInformation.php
+++ b/src/toolset/ArcanistWorkflowInformation.php
@@ -4,6 +4,7 @@
extends Phobject {
private $help;
+ private $synopsis;
private $examples = array();
public function setHelp($help) {
@@ -24,4 +25,13 @@
return $this->examples;
}
+ public function setSynopsis($synopsis) {
+ $this->synopsis = $synopsis;
+ return $this;
+ }
+
+ public function getSynopsis() {
+ return $this->synopsis;
+ }
+
}
diff --git a/src/toolset/workflow/ArcanistAliasWorkflow.php b/src/toolset/workflow/ArcanistAliasWorkflow.php
--- a/src/toolset/workflow/ArcanistAliasWorkflow.php
+++ b/src/toolset/workflow/ArcanistAliasWorkflow.php
@@ -75,9 +75,10 @@
);
return $this->newWorkflowInformation()
+ ->setSynopsis(
+ pht('Create and modify command aliases.'))
->addExample(pht('**alias**'))
- ->addExample(pht('**alias** __command__'))
- ->addExample(pht('**alias** __command__ __target__ -- [__options__]'))
+ ->addExample(pht('**alias** __command__ __target__ -- [__arguments__]'))
->setHelp($help);
}
diff --git a/src/toolset/workflow/ArcanistShellCompleteWorkflow.php b/src/toolset/workflow/ArcanistShellCompleteWorkflow.php
--- a/src/toolset/workflow/ArcanistShellCompleteWorkflow.php
+++ b/src/toolset/workflow/ArcanistShellCompleteWorkflow.php
@@ -60,6 +60,7 @@
);
return $this->newWorkflowInformation()
+ ->setSynopsis(pht('Install shell completion.'))
->setHelp($help);
}
diff --git a/src/toolset/workflow/ArcanistVersionWorkflow.php b/src/toolset/workflow/ArcanistVersionWorkflow.php
--- a/src/toolset/workflow/ArcanistVersionWorkflow.php
+++ b/src/toolset/workflow/ArcanistVersionWorkflow.php
@@ -22,6 +22,7 @@
);
return $this->newWorkflowInformation()
+ ->setSynopsis(pht('Show toolset version information.'))
->addExample(pht('**version**'))
->setHelp($help);
}
diff --git a/src/workflow/ArcanistAnoidWorkflow.php b/src/workflow/ArcanistAnoidWorkflow.php
--- a/src/workflow/ArcanistAnoidWorkflow.php
+++ b/src/workflow/ArcanistAnoidWorkflow.php
@@ -1,29 +1,43 @@
<?php
-final class ArcanistAnoidWorkflow extends ArcanistWorkflow {
+final class ArcanistAnoidWorkflow
+ extends ArcanistArcWorkflow {
public function getWorkflowName() {
return 'anoid';
}
- public function getCommandSynopses() {
- return phutil_console_format(<<<EOTEXT
- **anoid**
+ public function getWorkflowInformation() {
+ $help = pht(<<<EOTEXT
+Take control of a probe launched from the science vessel "Arcanoid".
EOTEXT
- );
+);
+
+ return $this->newWorkflowInformation()
+ ->setSynopsis(pht('Pilot a probe from the vessel "Arcanoid".'))
+ ->addExample(pht('**anoid**'))
+ ->setHelp($help);
}
- public function getCommandHelp() {
- return phutil_console_format(<<<EOTEXT
- There's only one way to find out...
-EOTEXT
- );
+ public function getWorkflowArguments() {
+ return array();
}
- public function run() {
- phutil_passthru(
- '%s/scripts/breakout.py',
- dirname(phutil_get_library_root('arcanist')));
+ public function runWorkflow() {
+ if (!Filesystem::binaryExists('python3')) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'The "arc anoid" workflow requires "python3" to be available '.
+ 'in your $PATH.'));
+ }
+
+ $support_dir = phutil_get_library_root('arcanist');
+ $support_dir = dirname($support_dir);
+ $support_dir = $support_dir.'/support/';
+
+ $bin = $support_dir.'arcanoid/arcanoid.py';
+
+ return phutil_passthru('%R', $bin);
}
}
diff --git a/src/workflow/ArcanistLiberateWorkflow.php b/src/workflow/ArcanistLiberateWorkflow.php
--- a/src/workflow/ArcanistLiberateWorkflow.php
+++ b/src/workflow/ArcanistLiberateWorkflow.php
@@ -16,6 +16,8 @@
);
return $this->newWorkflowInformation()
+ ->setSynopsis(
+ pht('Create or update an Arcanist library.'))
->addExample(pht('**liberate**'))
->addExample(pht('**liberate** [__path__]'))
->setHelp($help);
diff --git a/src/workflow/ArcanistWeldWorkflow.php b/src/workflow/ArcanistWeldWorkflow.php
--- a/src/workflow/ArcanistWeldWorkflow.php
+++ b/src/workflow/ArcanistWeldWorkflow.php
@@ -1,36 +1,37 @@
<?php
-final class ArcanistWeldWorkflow extends ArcanistWorkflow {
+final class ArcanistWeldWorkflow
+ extends ArcanistArcWorkflow {
public function getWorkflowName() {
return 'weld';
}
- public function getCommandSynopses() {
- return phutil_console_format(<<<EOTEXT
- **weld** [options] __file__ __file__ ...
+ public function getWorkflowInformation() {
+ $help = pht(<<<EOTEXT
+Robustly fuse two or more files together. The resulting joint is much stronger
+than the one created by tools like __cat__.
EOTEXT
);
- }
- public function getCommandHelp() {
- return phutil_console_format(<<<EOTEXT
- Robustly fuse two or more files together. The resulting joint is
- much stronger than the one created by tools like __cat__.
-EOTEXT
- );
+ return $this->newWorkflowInformation()
+ ->setSynopsis(pht('Robustly fuse files together.'))
+ ->addExample('**weld** [options] -- __file__ __file__ ...')
+ ->setHelp($help);
}
- public function getArguments() {
+ public function getWorkflowArguments() {
return array(
- '*' => 'files',
+ $this->newWorkflowArgument('files')
+ ->setWildcard(true),
);
}
- public function run() {
+ public function runWorkflow() {
$files = $this->getArgument('files');
+
if (count($files) < 2) {
- throw new ArcanistUsageException(
+ throw new PhutilArgumentUsageException(
pht('Specify two or more files to weld together.'));
}
diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -128,6 +128,10 @@
$information = $this->getWorkflowInformation();
if ($information) {
+ $synopsis = $information->getSynopsis();
+ if (strlen($synopsis)) {
+ $phutil_workflow->setSynopsis($synopsis);
+ }
$examples = $information->getExamples();
if ($examples) {
@@ -142,7 +146,6 @@
$phutil_workflow->setHelp($help);
}
-
}
return $phutil_workflow;
diff --git a/scripts/breakout.py b/support/arcanoid/arcanoid.py
rename from scripts/breakout.py
rename to support/arcanoid/arcanoid.py
--- a/scripts/breakout.py
+++ b/support/arcanoid/arcanoid.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
import sys
import time
import select
@@ -17,10 +17,10 @@
total = 0
def __init__(self, x, y, w, h, c):
- self.x = x
- self.y = y
- self.w = w
- self.h = h
+ self.x = int(round(x))
+ self.y = int(round(y))
+ self.w = int(round(w))
+ self.h = int(round(h))
self.fmt = curses.A_BOLD | curses.color_pair(c)
self.alive = True
for i in range(self.x, self.x + self.w):
@@ -48,8 +48,8 @@
killed = 0
def __init__(self, x, y, vx, vy):
- self.x = x
- self.y = y
+ self.x = int(round(x))
+ self.y = int(round(y))
self.vx = vx
self.vy = vy
Ball.alive = True
@@ -58,6 +58,8 @@
return True
def encounter(self, dx, dy):
+ dx = int(round(dx))
+ dy = int(round(dy))
ent = grid[self.y + dy + 1][self.x + dx + 1]
if ent and not ent.collide(self):
self.vx -= 2 * dx
@@ -84,8 +86,8 @@
class Ship:
def __init__(self, x, y):
- self.x = x
- self.y = y
+ self.x = int(round(x))
+ self.y = int(round(y))
self.hw = 10
self.v = 4
self.last = 1
@@ -164,7 +166,7 @@
colors = [ 1, 3, 2, 6, 4, 5 ]
h = height / 10
- for x in range(1, width / 7 - 1):
+ for x in range(1, int(width / 7) - 1):
for y in range(1, 7):
entities.append(Block(x * 7,
y * h + x / 2 % 2,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 17, 8:42 AM (1 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7708163
Default Alt Text
D21001.id.diff (10 KB)
Attached To
Mode
D21001: Port "arc weld" and "arc anoid" to Toolsets workflows, plus minor fixes
Attached
Detach File
Event Timeline
Log In to Comment