Add compact mode, toggle with 'c'
This commit is contained in:
@@ -6,18 +6,22 @@ class Settings
|
||||
{
|
||||
public static bool $editorQuotedKeys = false;
|
||||
|
||||
public static bool $compactGroups = false;
|
||||
|
||||
public static function load(string $filename): void
|
||||
{
|
||||
if (file_exists($filename) && is_readable($filename)) {
|
||||
$data = json_decode(file_get_contents($filename));
|
||||
self::$editorQuotedKeys = $data->editorQuotedKeys ?? false;
|
||||
self::$compactGroups = $data->compactGroups ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function save(string $filename): void
|
||||
{
|
||||
$data = json_encode([
|
||||
'editorQuotedKeys' => self::$editorQuotedKeys
|
||||
'editorQuotedKeys' => self::$editorQuotedKeys,
|
||||
'compactGroups' => self::$compactGroups,
|
||||
], JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)."\n";
|
||||
@file_put_contents($filename, $data);
|
||||
}
|
||||
@@ -27,6 +31,8 @@ class Settings
|
||||
switch ($key) {
|
||||
case 'editorQuotedKeys':
|
||||
self::$editorQuotedKeys = (bool)$value; break;
|
||||
case 'compactGroups':
|
||||
self::$compactGroups = (bool)$value; break;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user