cvs: pear-core /PEAR/Frontend CLI.php
| From: | Greg Beaver | Date: | Tue, 25 Apr 2006 02:57:57 +0000 |
| Subject: | cvs: pear-core /PEAR/Frontend CLI.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-4742@lists.php.net to get a copy of this message | ||
cellog Tue Apr 25 02:57:57 2006 UTC
Modified files:
/pear-core/PEAR/Frontend CLI.php
Log:
preserve default values when user hits "enter"
also, preserve "0" as distinct from ''
http://cvs.php.net/viewcvs.cgi/pear-core/PEAR/Frontend/CLI.php?r1=1.63&r2=1.64&diff_format=u
Index: pear-core/PEAR/Frontend/CLI.php
diff -u pear-core/PEAR/Frontend/CLI.php:1.63 pear-core/PEAR/Frontend/CLI.php:1.64
--- pear-core/PEAR/Frontend/CLI.php:1.63 Mon Apr 3 01:07:19 2006
+++ pear-core/PEAR/Frontend/CLI.php Tue Apr 25 02:57:57 2006
@@ -16,7 +16,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: CLI.php,v 1.63 2006/04/03 01:07:19 cellog Exp $
+ * @version CVS: $Id: CLI.php,v 1.64 2006/04/25 02:57:57 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*/
@@ -376,13 +376,16 @@
$desc = $prompts[$var];
$current = $result[$var];
print "$desc [$current] : ";
- $result[$var] = trim(fgets($fp, 1024));
+ $tmp = trim(fgets($fp, 1024));
+ if (trim($tmp) !== '') {
+ $result[$var] = trim($tmp);
+ }
} elseif ($tmp == 'all') {
foreach ($prompts as $var => $desc) {
$current = $result[$var];
print "$desc [$current] : ";
$tmp = trim(fgets($fp, 1024));
- if (!empty($tmp)) {
+ if (trim($tmp) !== '') {
$result[$var] = trim($tmp);
}
}