Add icons to items in before mode, ask to save changes
This commit is contained in:
@ -21,6 +21,11 @@ class TreeList implements Countable
|
||||
private const TREE_INDENT_GUIDE = "\u{258f} ";
|
||||
private const TREE_INDENT = " ";
|
||||
|
||||
private const ICON_NUMERIC = "\u{f89f}";
|
||||
private const ICON_STRING = "\u{f475}";
|
||||
private const ICON_BOOL = "\u{f657}";
|
||||
private const ICON_NULL = "\u{2400}";
|
||||
|
||||
public function __construct(private Tree $tree)
|
||||
{
|
||||
}
|
||||
@ -186,6 +191,16 @@ class TreeList implements Countable
|
||||
}
|
||||
|
||||
if (!is_null($entry->key)) {
|
||||
if (Settings::$collapseBefore && $entry->node instanceof ValueNode) {
|
||||
echo match (gettype($entry->node->value)) {
|
||||
'string' => self::ICON_STRING,
|
||||
'integer' => self::ICON_NUMERIC,
|
||||
'double' => self::ICON_NUMERIC,
|
||||
'boolean' => self::ICON_BOOL,
|
||||
'NULL' => self::ICON_NULL,
|
||||
default => self::ICON_STRING,
|
||||
}." ";
|
||||
}
|
||||
echo (is_int($entry->key)
|
||||
?"\e[36;2m\u{e0b6}\e[7m#{$entry->key}\e[27m\u{e0b4}\e[22;37m "
|
||||
:(Settings::$editorQuotedKeys
|
||||
|
Reference in New Issue
Block a user