Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14907323
D11907.id28687.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11907.id28687.diff
View Options
diff --git a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php
--- a/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php
+++ b/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php
@@ -7,7 +7,7 @@
$this
->setName('generate')
->setExamples('**generate**')
- ->setSynopsis('Generate some lipsum.')
+ ->setSynopsis(pht('Generate some lipsum.'))
->setArguments(
array(
array(
@@ -18,47 +18,60 @@
}
public function execute(PhutilArgumentParser $args) {
+ $console = PhutilConsole::getConsole();
+
$supported_types = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorTestDataGenerator')
->loadObjects();
- echo "These are the types of data you can generate:\n";
- foreach (array_keys($supported_types) as $typetmp) {
- echo "\t".$typetmp."\n";
- }
- echo "\n";
- $prompt = 'Are you sure you want to generate lots of test data?';
- if (!phutil_console_confirm($prompt, $default_no = true)) {
+
+ $console->writeOut(
+ "%s:\n\t%s\n",
+ pht('These are the types of data you can generate'),
+ implode("\n\t", array_keys($supported_types)));
+
+ $prompt = pht('Are you sure you want to generate lots of test data?');
+ if (!phutil_console_confirm($prompt, true)) {
return;
}
+
$argv = $args->getArg('args');
- if (count($argv) == 0 ||
- (count($argv) == 1 && $argv[0] == 'all')) {
+ if (count($argv) == 0 || (count($argv) == 1 && $argv[0] == 'all')) {
$this->infinitelyGenerate($supported_types);
} else {
$new_supported_types = array();
- for ($i = 0; $i < count($argv);$i++) {
+ for ($i = 0; $i < count($argv); $i++) {
$arg = $argv[$i];
if (array_key_exists($arg, $supported_types)) {
- $new_supported_types[$arg] = $supported_types[$arg];
+ $new_supported_types[$arg] = $supported_types[$arg];
} else {
- echo "The type ".$arg." is not supported by the lipsum generator.\n";
+ $console->writeErr(
+ "%s\n",
+ pht(
+ 'The type %s is not supported by the lipsum generator.',
+ $arg));
}
}
$this->infinitelyGenerate($new_supported_types);
}
- echo "None of the input types were supported.\n";
- echo "The supported types are:\n";
- echo implode("\n", array_keys($supported_types));
+
+ $console->writeOut(
+ "%s\n%s:\n%s\n",
+ pht('None of the input types were supported.'),
+ pht('The supported types are'),
+ implode("\n", array_keys($supported_types)));
}
protected function infinitelyGenerate(array $supported_types) {
+ $console = PhutilConsole::getConsole();
+
if (count($supported_types) == 0) {
- echo "None of the input types were supported.\n";
return;
}
- echo 'GENERATING: ';
- echo strtoupper(implode(' , ', array_keys($supported_types)));
- echo "\n";
+ $console->writeOut(
+ "%s: %s\n",
+ pht('GENERATING'),
+ implode(', ', array_keys($supported_types)));
+
while (true) {
$type = $supported_types[array_rand($supported_types)];
$admin = $this->getViewer();
@@ -69,8 +82,11 @@
->setViewer($admin)
->withPHIDs(array($object->getPHID()))
->executeOne();
- echo "Generated ".$handle->getTypeName().": ".
- $handle->getFullName()."\n";
+
+ $console->writeOut(
+ "%s: %s\n",
+ pht('Generated %s', $handle->getTypeName()),
+ $handle->getFullName());
usleep(200000);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 11, 3:36 AM (9 h, 6 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7122156
Default Alt Text
D11907.id28687.diff (3 KB)
Attached To
Mode
D11907: Minor tidying of `lipsum generate` workflow
Attached
Detach File
Event Timeline
Log In to Comment