Skip to content
Permalink
Browse files

udpate some console helper methods

  • Loading branch information...
inhere committed Jul 30, 2019
1 parent 2114861 commit 0181138af6f1bc1dc0f3f1025b23d9a6354d122a
@@ -55,7 +55,6 @@ public static function show(string $title, array $opts = []): void
$titleIndent = Str::pad(self::CHAR_SPACE, $indent, self::CHAR_SPACE);
}
if ($indent > 0) {
$bdIndent = Str::pad(self::CHAR_SPACE, $indent, self::CHAR_SPACE);
}
@@ -2,8 +2,10 @@
namespace Swoft\Console\Concern;
use Closure;
use Generator;
use LogicException;
use Swoft\Console\Helper\Interact;
use Swoft\Console\Helper\Show;
use Swoft\Console\Style\Style;
use Swoft\Stdlib\Helper\PhpHelper;
@@ -47,6 +49,12 @@
* @method pointing($msg = 'handling ', $ended = false)
*
* @method Generator counterTxt($msg = 'Pending ', $ended = false)
*
* @method confirm(string $question, bool $default = true, bool $nl = true): bool
* @method select(string $description, $options, $default = null, bool $allowExit = true): string
* @method checkbox(string $description, $options, $default = null, bool $allowExit = true): array
* @method ask(string $question, string $default = '', Closure $validator = null): string
* @method askPassword(string $prompt = 'Enter Password:'): string
*/
trait FormatOutputAwareTrait
{
@@ -235,6 +243,10 @@ public function __call($method, array $args = [])
return Show::$method(...$args);
}
if (method_exists(Interact::class, $method)) {
return Interact::$method(...$args);
}
throw new LogicException("Call a not exists method: $method of the " . static::class);
}
@@ -204,9 +204,9 @@ public static function answerIsYes(bool $default = null): bool
* @param string $question question message
* @param string $default default value
* @param Closure $validator The validate callback. It must return bool.
* @return string|null
* @return string
*/
public static function ask(string $question, string $default = '', Closure $validator = null): ?string
public static function ask(string $question, string $default = '', Closure $validator = null): string
{
return self::question($question, $default, $validator);
}

0 comments on commit 0181138

Please sign in to comment.
You can’t perform that action at this time.