mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding some colour to Shell::createFile()
Removing the now dead Shell::help(). The OptionParser approach provides much better help information than this method did.
This commit is contained in:
parent
56339e05f3
commit
fe7c7a1b12
1 changed files with 4 additions and 17 deletions
|
@ -548,11 +548,11 @@ class Shell extends Object {
|
|||
$this->out(sprintf(__('Creating file %s'), $path));
|
||||
|
||||
if (is_file($path) && $this->interactive === true) {
|
||||
$prompt = sprintf(__('File `%s` exists, overwrite?'), $path);
|
||||
$prompt = sprintf(__('<warning>File `%s` exists</warning>, overwrite?'), $path);
|
||||
$key = $this->in($prompt, array('y', 'n', 'q'), 'n');
|
||||
|
||||
if (strtolower($key) == 'q') {
|
||||
$this->out(__('Quitting.'), 2);
|
||||
$this->out(__('<error>Quitting</error>.'), 2);
|
||||
$this->_stop();
|
||||
} elseif (strtolower($key) != 'y') {
|
||||
$this->out(sprintf(__('Skip `%s`'), $path), 2);
|
||||
|
@ -566,27 +566,14 @@ class Shell extends Object {
|
|||
if ($File = new File($path, true)) {
|
||||
$data = $File->prepare($contents);
|
||||
$File->write($data);
|
||||
$this->out(sprintf(__('Wrote `%s`'), $path));
|
||||
$this->out(sprintf(__('<success>Wrote</success> `%s`'), $path));
|
||||
return true;
|
||||
} else {
|
||||
$this->err(sprintf(__('Could not write to `%s`.'), $path), 2);
|
||||
$this->err(sprintf(__('<error>Could not write to `%s`</error>.'), $path), 2);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs usage text on the standard output. Implement it in subclasses.
|
||||
*
|
||||
*/
|
||||
public function help() {
|
||||
if ($this->command != null) {
|
||||
$this->err("Unknown {$this->name} command `{$this->command}`.");
|
||||
$this->err("For usage, try `cake {$this->shell} help`.", 2);
|
||||
} else {
|
||||
$this->Dispatch->help();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to create a Unit Test
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue