Skip to content

Commit 14d623d

Browse files
committed
up: update some for cmd builder
1 parent 82be07f commit 14d623d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Cmd/AbstractCmdBuilder.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use RuntimeException;
1313
use Toolkit\Stdlib\Helper\Assert;
14+
use Toolkit\Stdlib\Str;
1415
use Toolkit\Sys\Exec;
1516
use function trim;
1617

@@ -277,11 +278,23 @@ public function isSuccess(): bool
277278
*
278279
* @return string
279280
*/
280-
public function getOutput(bool $trim = false): string
281+
public function getOutput(bool $trim = true): string
281282
{
282283
return $trim ? trim($this->output) : $this->output;
283284
}
284285

286+
/**
287+
* get output as lines
288+
*
289+
* @return string[]
290+
*/
291+
public function getOutputLines(): array
292+
{
293+
$out = trim($this->output);
294+
295+
return $out ? Str::splitTrimmed($out, "\n") : [];
296+
}
297+
285298
/**
286299
* @return array
287300
*/

0 commit comments

Comments
 (0)