mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Display: add compactMode: null; improve json schema
This commit is contained in:
+18
-5
@@ -2067,12 +2067,25 @@
|
||||
},
|
||||
"order": {
|
||||
"description": "Set the order should be used when printing",
|
||||
"enum": [
|
||||
"none",
|
||||
"asc",
|
||||
"desc"
|
||||
"oneOf": [
|
||||
{
|
||||
"const": null,
|
||||
"description": "Use the default order"
|
||||
},
|
||||
{
|
||||
"const": "none",
|
||||
"description": "Use the detected order (kept for compatibility)"
|
||||
},
|
||||
{
|
||||
"const": "asc",
|
||||
"description": "Sort by display name in ascending order"
|
||||
},
|
||||
{
|
||||
"const": "desc",
|
||||
"description": "Sort by display name in descending order"
|
||||
}
|
||||
],
|
||||
"default": "none"
|
||||
"default": null
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
|
||||
@@ -257,17 +257,22 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
|
||||
|
||||
if (unsafe_yyjson_equals_str(key, "order"))
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
{ "asc", FF_DISPLAY_ORDER_ASC },
|
||||
{ "desc", FF_DISPLAY_ORDER_DESC },
|
||||
{ "none", FF_DISPLAY_ORDER_NONE },
|
||||
{},
|
||||
});
|
||||
if (error)
|
||||
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
|
||||
if (yyjson_is_null(val))
|
||||
options->order = FF_DISPLAY_ORDER_NONE;
|
||||
else
|
||||
options->order = (FFDisplayOrder) value;
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
{ "asc", FF_DISPLAY_ORDER_ASC },
|
||||
{ "desc", FF_DISPLAY_ORDER_DESC },
|
||||
{ "none", FF_DISPLAY_ORDER_NONE },
|
||||
{},
|
||||
});
|
||||
if (error)
|
||||
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
|
||||
else
|
||||
options->order = (FFDisplayOrder) value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user