Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make input prompt clearer in extract task.

Make the prompt display the paths that will be scanned.  Hopefully
this makes the shell a bit easier to use and understand. Also
make the shell not accept 0 paths as a correct answer.

Fixes #2877
  • Loading branch information...
commit 8103eae9f114d428f7c4d1cb038c53baad5b0abc 1 parent 15a7472
@markstory markstory authored
Showing with 33 additions and 18 deletions.
  1. +33 −18 lib/Cake/Console/Command/Task/ExtractTask.php
View
51 lib/Cake/Console/Command/Task/ExtractTask.php
@@ -105,6 +105,38 @@ class ExtractTask extends AppShell {
protected $_validationDomain = 'default';
/**
+ * Method to interact with the User and get path selections.
+ *
+ * @return void
+ */
+ protected function _getPaths() {
+ $defaultPath = APP;
+ while (true) {
+ $currentPaths = count($this->_paths) > 0 ? $this->_paths : array('None');
+ $message = __d(
+ 'cake_console',
+ "Current paths: %s\nWhat is the path you would like to extract?\n[Q]uit [D]one",
+ implode(', ', $currentPaths)
+ );
+ $response = $this->in($message, null, $defaultPath);
+ if (strtoupper($response) === 'Q') {
+ $this->out(__d('cake_console', 'Extract Aborted'));
+ return $this->_stop();
+ } elseif (strtoupper($response) === 'D' && count($this->_paths)) {
+ $this->out();
+ return;
+ } elseif (strtoupper($response) === 'D') {
+ $this->err(__d('cake_console', '<warning>No directories selected.</warning> Please choose a directory.'));
+ } elseif (is_dir($response)) {
+ $this->_paths[] = $response;
+ $defaultPath = 'D';
+ } else {
+ $this->err(__d('cake_console', 'The directory path you supplied was not found. Please try again.'));
+ }
+ $this->out();
+ }
+ }
+/**
* Execution method always used for tasks
*
* @return void
@@ -126,24 +158,7 @@ public function execute() {
$this->_paths = array(CakePlugin::path($plugin));
$this->params['plugin'] = $plugin;
} else {
- $defaultPath = APP;
- $message = __d('cake_console', "What is the path you would like to extract?\n[Q]uit [D]one");
- while (true) {
- $response = $this->in($message, null, $defaultPath);
- if (strtoupper($response) === 'Q') {
- $this->out(__d('cake_console', 'Extract Aborted'));
- $this->_stop();
- } elseif (strtoupper($response) === 'D') {
- $this->out();
- break;
- } elseif (is_dir($response)) {
- $this->_paths[] = $response;
- $defaultPath = 'D';
- } else {
- $this->err(__d('cake_console', 'The directory path you supplied was not found. Please try again.'));
- }
- $this->out();
- }
+ $this->_getPaths();
}
if (!empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) {

0 comments on commit 8103eae

Please sign in to comment.
Something went wrong with that request. Please try again.