浏览代码

Simplify shells.

euromark 11 年之前
父节点
当前提交
37c6c3ea56

+ 16 - 16
Console/Command/CodeShell.php

@@ -35,11 +35,11 @@ class CodeShell extends AppShell {
 
 		$this->_findFiles('php');
 		foreach ($this->_files as $file) {
-			$this->out(__d('cake_console', 'Updating %s...', $file), 1, Shell::VERBOSE);
+			$this->out(sprintf('Updating %s...', $file), 1, Shell::VERBOSE);
 
 			$this->_correctFile($file);
 
-			$this->out(__d('cake_console', 'Done updating %s', $file), 1, Shell::VERBOSE);
+			$this->out(sprintf('Done updating %s', $file), 1, Shell::VERBOSE);
 		}
 	}
 
@@ -168,7 +168,7 @@ class CodeShell extends AppShell {
 
 		if (empty($this->params['dry-run'])) {
 			file_put_contents($file, $fileContent);
-			$this->out(__d('cake_console', 'Correcting %s', $file), 1, Shell::VERBOSE);
+			$this->out(sprintf('Correcting %s', $file), 1, Shell::VERBOSE);
 		}
 	}
 
@@ -206,7 +206,7 @@ class CodeShell extends AppShell {
 	protected function _filesRegexpUpdate($patterns) {
 		$this->_findFiles($this->params['ext']);
 		foreach ($this->_files as $file) {
-			$this->out(__d('cake_console', 'Updating %s...', $file), 1, Shell::VERBOSE);
+			$this->out(sprintf('Updating %s...', $file), 1, Shell::VERBOSE);
 			$this->_utf8File($file, $patterns);
 		}
 	}
@@ -267,11 +267,11 @@ class CodeShell extends AppShell {
 		$contents = $fileContent = file_get_contents($file);
 
 		foreach ($patterns as $pattern) {
-			$this->out(__d('cake_console', ' * Updating %s', $pattern[0]), 1, Shell::VERBOSE);
+			$this->out(sprintf(' * Updating %s', $pattern[0]), 1, Shell::VERBOSE);
 			$contents = preg_replace($pattern[1], $pattern[2], $contents);
 		}
 
-		$this->out(__d('cake_console', 'Done updating %s', $file), 1, Shell::VERBOSE);
+		$this->out(sprintf('Done updating %s', $file), 1, Shell::VERBOSE);
 		if (!$this->params['dry-run'] && $contents !== $fileContent) {
 			if (file_exists($file)) {
 				unlink($file);
@@ -288,45 +288,45 @@ class CodeShell extends AppShell {
 			'options' => array(
 				'plugin' => array(
 					'short' => 'p',
-					'help' => __d('cake_console', 'The plugin to update. Only the specified plugin will be updated.'),
+					'help' => 'The plugin to update. Only the specified plugin will be updated.',
 					'default' => ''
 				),
 				'custom' => array(
 					'short' => 'c',
-					'help' => __d('cake_console', 'Custom path to update recursivly.'),
+					'help' => 'Custom path to update recursivly.',
 					'default' => ''
 				),
 				'ext' => array(
 					'short' => 'e',
-					'help' => __d('cake_console', 'The extension(s) to search. A pipe delimited list, or a preg_match compatible subpattern'),
+					'help' => 'The extension(s) to search. A pipe delimited list, or a preg_match compatible subpattern',
 					'default' => 'php|ctp|thtml|inc|tpl'
 				),
 				'vendor' => array(
 					'short' => 'e',
-					'help' => __d('cake_console', 'Include vendor files, as well'),
+					'help' => 'Include vendor files, as well',
 					'boolean' => true
 				),
 				'dry-run' => array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'),
+					'help' => 'Dry run the update, no files will actually be modified.',
 					'boolean' => true
 				)
 			)
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', "A shell to help automate code cleanup. \n" .
-				"Be sure to have a backup of your application before running these commands."))
+			->description("A shell to help automate code cleanup. \n" .
+				"Be sure to have a backup of your application before running these commands.")
 			->addSubcommand('group', array(
-				'help' => __d('cake_console', 'Run multiple commands.'),
+				'help' => 'Run multiple commands.',
 				'parser' => $subcommandParser
 			))
 			->addSubcommand('dependencies', array(
-				'help' => __d('cake_console', 'Correct dependencies'),
+				'help' => 'Correct dependencies',
 				'parser' => $subcommandParser
 			))
 			->addSubcommand('utf8', array(
-				'help' => __d('cake_console', 'Make files utf8 compliant'),
+				'help' => 'Make files utf8 compliant',
 				'parser' => $subcommandParser
 			));
 	}

+ 9 - 9
Console/Command/ConvertShell.php

@@ -48,10 +48,10 @@ class ConvertShell extends AppShell {
 		$this->binPath = Configure::read('Cli.dos2unixPath');
 
 		if ($this->params['dry-run']) {
-			$this->out(__d('cake_console', '<warning>Dry-run mode enabled!</warning>'), 1, Shell::QUIET);
+			$this->out('<warning>Dry-run mode enabled!</warning>', 1, Shell::QUIET);
 		}
 		if (false && !$this->_test()) {
-			$this->out(__d('cake_console', '<warning>dos2unix not available</warning>'), 1, Shell::QUIET);
+			$this->out('<warning>dos2unix not available</warning>', 1, Shell::QUIET);
 		}
 	}
 
@@ -155,22 +155,22 @@ class ConvertShell extends AppShell {
 			'options' => array(
 				'mode' => array(
 					'short' => 'm',
-					'help' => __d('cake_console', 'Mode'),
+					'help' => 'Mode',
 					'default' => '' # auto detect
 				),
 				'ext' => array(
 					'short' => 'e',
-					'help' => __d('cake_console', 'Specify extensions [php|txt|...]'),
+					'help' => 'Specify extensions [php|txt|...]',
 					'default' => '',
 				),
 				'dry-run' => array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the clear command, no files will actually be deleted. Should be combined with verbose!'),
+					'help' => 'Dry run the clear command, no files will actually be deleted. Should be combined with verbose!',
 					'boolean' => true
 				),
 				'exclude' => array(
 					'short' => 'x',
-					'help' => __d('cake_console', 'exclude the following files or folders'),
+					'help' => 'Exclude the following files or folders',
 					'boolean' => true,
 					'default' => ''
 				)
@@ -178,13 +178,13 @@ class ConvertShell extends AppShell {
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', "The Convert Shell converts files from dos/unix/mac to another system"))
+			->description("The Convert Shell converts files from dos/unix/mac to another system")
 			->addSubcommand('version', array(
-				'help' => __d('cake_console', 'Test and display version.'),
+				'help' => 'Test and display version.',
 				'parser' => $subcommandParser
 			))
 			->addSubcommand('folder', array(
-				'help' => __d('cake_console', 'Convert folder recursivly (Tools.Convert folder [options] [path])'),
+				'help' => 'Convert folder recursivly (Tools.Convert folder [options] [path])',
 				'parser' => $subcommandParser
 			));
 	}

+ 14 - 13
Console/Command/CopyShell.php

@@ -605,6 +605,7 @@ class CopyShell extends AppShell {
 	 *
 	 * @param string $config name
 	 * @param array $content
+	 * @return array
 	 */
 	protected function getConfig($config, $content) {
 		$configs = array();
@@ -640,66 +641,66 @@ class CopyShell extends AppShell {
 				/*
 				'plugin' => array(
 					'short' => 'g',
-					'help' => __d('cake_console', 'The plugin to update. Only the specified plugin will be updated.'),
+					'help' => 'The plugin to update. Only the specified plugin will be updated.'),
 					'default' => ''
 				),
 				'dry-run'=> array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'),
+					'help' => 'Dry run the update, no files will actually be modified.'),
 					'boolean' => true
 				),
 				'log'=> array(
 					'short' => 'l',
-					'help' => __d('cake_console', 'Log all ouput to file log.txt in TMP dir'),
+					'help' => 'Log all ouput to file log.txt in TMP dir'),
 					'boolean' => true
 				),
 				*/
 				'silent' => array(
 					'short' => 's',
-					'help' => __d('cake_console', 'Silent mode (no beep sound)'),
+					'help' => 'Silent mode (no beep sound)',
 					'boolean' => true
 				),
 				'vendors' => array(
 					'short' => 'e',
-					'help' => __d('cake_console', 'ROOT/vendor'),
+					'help' => 'ROOT/vendor',
 					'boolean' => true
 				),
 				'cake' => array(
 					'short' => 'c',
-					'help' => __d('cake_console', 'ROOT/lib/Cake'),
+					'help' => 'ROOT/lib/Cake',
 					'boolean' => true
 				),
 				'app' => array(
 					'short' => 'a',
-					'help' => __d('cake_console', 'ROOT/app'),
+					'help' => 'ROOT/app',
 					'boolean' => true
 				),
 				'plugins' => array(
 					'short' => 'p',
-					'help' => __d('cake_console', 'ROOT/plugin'),
+					'help' => 'ROOT/plugin',
 					'boolean' => true
 				),
 				'custom' => array(
 					'short' => 'u',
-					'help' => __d('cake_console', 'custom'),
+					'help' => 'Custom path',
 					'boolean' => true
 				),
 				'force' => array(
 					'short' => 'f',
-					'help' => __d('cake_console', 'force (keep going regardless of errors)'),
+					'help' => 'Force (keep going regardless of errors)',
 					'boolean' => true
 				),
 				'debug' => array(
-					'help' => __d('cake_console', 'Debug output only'),
+					'help' => 'Debug output only',
 					'boolean' => true
 				)
 			)
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', "A shell to quickly upload modified files (diff) only."))
+			->description("A shell to quickly upload modified files (diff) only.")
 			->addSubcommand('run', array(
-				'help' => __d('cake_console', 'Update'),
+				'help' => 'Update',
 				'parser' => $subcommandParser
 			));
 	}

+ 5 - 5
Console/Command/EncodingShell.php

@@ -120,17 +120,17 @@ class EncodingShell extends AppShell {
 			'options' => array(
 				'ext' => array(
 					'short' => 'e',
-					'help' => __d('cake_console', 'Specify extensions [php|txt|...] - defaults to [php].'),
+					'help' => 'Specify extensions [php|txt|...] - defaults to [php].',
 					'default' => '',
 				),
 				'dry-run' => array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the command, no files will actually be modified. Should be combined with verbose.'),
+					'help' => 'Dry run the command, no files will actually be modified. Should be combined with verbose.',
 					'boolean' => true
 				),
 				'exclude' => array(
 					'short' => 'x',
-					'help' => __d('cake_console', 'exclude the following files'),
+					'help' => 'Exclude the following files',
 					'boolean' => true,
 					'default' => ''
 				)
@@ -138,9 +138,9 @@ class EncodingShell extends AppShell {
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', 'The %sShell finds BOM files and can correct them.', $this->name))
+			->description(sprintf('The %sShell finds BOM files and can correct them.', $this->name))
 			->addSubcommand('folder', array(
-				'help' => __d('cake_console', 'Search and correct folder recursivly.'),
+				'help' => 'Search and correct folder recursivly.',
 				'parser' => $subcommandParser
 			));
 	}

+ 9 - 9
Console/Command/FolderSyncShell.php

@@ -167,46 +167,46 @@ class FolderSyncShell extends AppShell {
 			'options' => array(
 				'source' => array(
 					'short' => 's',
-					'help' => __d('cake_console', 'source - defaults to app'),
+					'help' => 'source - defaults to app',
 					'default' => '',
 				),
 				'target' => array(
 					'short' => 't',
-					'help' => __d('cake_console', 'target - required'),
+					'help' => 'target - required',
 					'default' => '',
 				),
 				'plugin' => array(
 					'short' => 'p',
-					'help' => __d('cake_console', 'The plugin folder - can only be used with app as source'),
+					'help' => 'The plugin folder - can only be used with app as source',
 					'default' => '',
 				),
 				'remove' => array(
 					'short' => 'r',
-					'help' => __d('cake_console', 'Remove files if source is non-existent'),
+					'help' => 'Remove files if source is non-existent',
 					'boolean' => true
 				),
 				'invert' => array(
 					'short' => 'i',
-					'help' => __d('cake_console', 'Invert direction (target to source)'),
+					'help' => 'Invert direction (target to source)',
 					'boolean' => true
 				),
 				'dry-run' => array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'),
+					'help' => 'Dry run the update, no files will actually be modified.',
 					'boolean' => true
 				),
 				'log' => array(
 					'short' => 'l',
-					'help' => __d('cake_console', 'Log all ouput to file log.txt in TMP dir'),
+					'help' => 'Log all ouput to file log.txt in TMP dir',
 					'boolean' => true
 				),
 			)
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', "..."))
+			->description('Sync folders via CakePHP shell')
 			->addSubcommand('update', array(
-				'help' => __d('cake_console', 'Update'),
+				'help' => 'Update',
 				'parser' => $subcommandParser
 			));
 	}

+ 8 - 8
Console/Command/IndentShell.php

@@ -327,41 +327,41 @@ class IndentShell extends AppShell {
 			'options' => array(
 				'dry-run' => array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'),
+					'help' => 'Dry run the update, no files will actually be modified.',
 					'boolean' => true
 				),
 				'log' => array(
 					'short' => 'l',
-					'help' => __d('cake_console', 'Log all ouput to file log.txt in TMP dir'),
+					'help' => 'Log all ouput to file log.txt in TMP dir',
 					'boolean' => true
 				),
 				'interactive' => array(
 					'short' => 'i',
-					'help' => __d('cake_console', 'Interactive'),
+					'help' => 'Interactive',
 					'boolean' => true
 				),
 				'spaces' => array(
 					'short' => 's',
-					'help' => __d('cake_console', 'Spaces per Tab'),
+					'help' => 'Spaces per Tab',
 					'default' => '4',
 				),
 				'extensions' => array(
 					'short' => 'e',
-					'help' => __d('cake_console', 'Extensions (comma-separated)'),
+					'help' => 'Extensions (comma-separated)',
 					'default' => '',
 				),
 				'again' => array(
 					'short' => 'a',
-					'help' => __d('cake_console', 'Again (with half) afterwards'),
+					'help' => 'Again (with half) afterwards',
 					'boolean' => true
 				),
 			)
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', "Correct indentation of files"))
+			->description("Correct indentation of files")
 			->addSubcommand('folder', array(
-				'help' => __d('cake_console', 'Indent all files in a folder'),
+				'help' => 'Indent all files in a folder',
 				'parser' => $subcommandParser
 			));
 	}

+ 6 - 7
Console/Command/IndexShell.php

@@ -18,7 +18,6 @@ App::uses('AppShell', 'Console/Command');
  * - PRIMARY_KEY Indexes for primary keys ("id")
  *
  * @author Mark Scherer
- * @link
  * @license http://www.opensource.org/licenses/mit-license.php The MIT License
  */
 class IndexShell extends AppShell {
@@ -250,31 +249,31 @@ class IndexShell extends AppShell {
 			'options' => array(
 				'dry-run' => array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'),
+					'help' => 'Dry run the update, no files will actually be modified.',
 					'boolean' => true
 				),
 				'log' => array(
 					'short' => 'l',
-					'help' => __d('cake_console', 'Log all ouput to file log.txt in TMP dir'),
+					'help' => 'Log all ouput to file log.txt in TMP dir',
 					'boolean' => true
 				),
 				'interactive' => array(
 					'short' => 'i',
-					'help' => __d('cake_console', 'Interactive'),
+					'help' => 'Interactive',
 					'boolean' => true
 				),
 				'ds' => array(
 					'short' => 'c',
-					'help' => __d('cake_console', 'custom ds'),
+					'help' => 'Custom ds',
 					'boolean' => true
 				)
 			)
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', "..."))
+			->description("...")
 			->addSubcommand('run', array(
-				'help' => __d('cake_console', 'Run'),
+				'help' => 'Run',
 				'parser' => $subcommandParser
 			));
 	}

+ 6 - 6
Console/Command/WhitespaceShell.php

@@ -152,31 +152,31 @@ class WhitespaceShell extends AppShell {
 			'options' => array(
 				'ext' => array(
 					'short' => 'e',
-					'help' => __d('cake_console', 'Specify extensions [php|txt|...]'),
+					'help' => 'Specify extensions [php|txt|...]'),
 					'default' => '',
 				),
 				'dry-run' => array(
 					'short' => 'd',
-					'help' => __d('cake_console', 'Dry run the clear command, no files will actually be deleted. Should be combined with verbose!'),
+					'help' => 'Dry run the clear command, no files will actually be deleted. Should be combined with verbose!'),
 					'boolean' => true
 				),
 				'plugin' => array(
 					'short' => 'p',
-					'help' => __d('cake_console', 'Plugin'),
+					'help' => 'Plugin'),
 					'default' => '',
 				),
 			)
 		);
 
 		return parent::getOptionParser()
-			->description(__d('cake_console', 'The Whitespace Shell removes uncessary/wrong whitespaces.
+			->description('The Whitespace Shell removes uncessary/wrong whitespaces.
 Either provide a path as first argument, use -p PluginName or run it as it is for the complete APP dir.'))
 			->addSubcommand('find', array(
-				'help' => __d('cake_console', 'Detect any leading/trailing whitespaces'),
+				'help' => 'Detect any leading/trailing whitespaces'),
 				'parser' => $subcommandParser
 			))
 			->addSubcommand('eof', array(
-				'help' => __d('cake_console', 'Fix whitespaces at the end of PHP files (a single newline as per coding standards)'),
+				'help' => 'Fix whitespaces at the end of PHP files (a single newline as per coding standards)'),
 				'parser' => $subcommandParser
 			));
 	}