Skip to content

Commit b70a617

Browse files
committed
Added non-interactive support
1 parent 224ef64 commit b70a617

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/CLI/Console.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ static public function warning(string $message)
9292
*/
9393
static public function confirm(string $question)
9494
{
95+
if(!self::isInteractive()) {
96+
return null;
97+
}
98+
9599
self::log($question);
96100

97101
$handle = \fopen('php://stdin', 'r');
@@ -168,7 +172,12 @@ static public function execute(string $cmd, string $stdin = null, string &$stdou
168172
return 1;
169173
}
170174

171-
public function isInteractive(): bool
175+
/**
176+
* Is Interactive Mode?
177+
*
178+
* @return bool
179+
*/
180+
static public function isInteractive(): bool
172181
{
173182
return ('cli' === PHP_SAPI && ! defined('STDOUT'));
174183
}

0 commit comments

Comments
 (0)