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 @@ newWorkflowInformation() + ->setSynopsis(pht('Pilot a probe from the "Arcanoid".')) + ->addExample(pht('**anoid**')) + ->setHelp($help); } - public function getCommandHelp() { - return phutil_console_format(<<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 @@ 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,