Skip to content

Commit

Permalink
fix: echoln and json cli pretty error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 25, 2021
1 parent 321d252 commit 973fd28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Component/Formatter/JSONPretty.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function renderData(array $data): string
continue;
}

[$key, $val] = explode(': ', $line);
[$key, $val] = explode(': ', $line, 2);

// format key name.
if ($keyTag = $this->theme['keyName']) {
Expand Down
4 changes: 2 additions & 2 deletions src/Concern/FormatOutputAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ public function write($messages, $nl = true, $quit = false, array $opts = []): i
*/
public function echo(...$args): void
{
echo count($args) > 1 ? implode(' ', $args) : $args;
echo count($args) > 1 ? implode(' ', $args) : $args[0];
}

/**
* @param ...$args
*/
public function echoln(...$args): void
{
echo (count($args) > 1 ? implode(' ', $args) : $args), PHP_EOL;
echo (count($args) > 1 ? implode(' ', $args) : $args[0]), PHP_EOL;
}

/**
Expand Down

0 comments on commit 973fd28

Please sign in to comment.