From 6801fe3d9ca3756325a7bae98c8bd0070e46fbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 14 Nov 2024 14:22:24 +0800 Subject: [PATCH] Doc: update schema for percent type config --- doc/json_schema.json | 38 +++++++++++++++++++++++++++++++++----- src/data/help.json | 18 ++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/doc/json_schema.json b/doc/json_schema.json index 7450e0884..3c0c9fa76 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -34,6 +34,35 @@ "description": "Output color of the module. Left empty to use `display.color.output`", "$ref": "#/$defs/colors" }, + "percentType": { + "description": "Set the percentage output type", + "oneOf": [ + { + "type": "number", + "description": "1 for percentage number, 2 for multi-color bar, 3 for both, 6 for bar only, 9 for colored number, 10 for monochrome bar", + "minimum": 0, + "maximum": 255, + "default": 9 + }, + { + "type": "array", + "description": "array of string flags", + "items": { + "enum": [ + "num", + "bar", + "hide-others", + "num-color", + "bar-monochrome" + ] + }, + "default": [ + "num", + "num-color" + ] + } + ] + }, "percent": { "description": "Threshold of percentage colors", "type": "object", @@ -50,6 +79,9 @@ "minimum": 0, "maximum": 100, "description": "Value greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red" + }, + "type": { + "$ref": "#/$defs/percentType" } } }, @@ -576,11 +608,7 @@ "description": "Set how a percentage value should be displayed", "properties": { "type": { - "type": "number", - "description": "Set the percentage output type. 1 for percentage number, 2 for multi-color bar, 3 for both, 6 for bar only, 9 for colored number, 10 for monochrome bar", - "minimum": 0, - "maximum": 255, - "default": 9 + "$ref": "#/$defs/percentType" }, "ndigits": { "type": "number", diff --git a/src/data/help.json b/src/data/help.json index c7e4a88ec..481b3a3e2 100644 --- a/src/data/help.json +++ b/src/data/help.json @@ -1602,6 +1602,24 @@ }, "pseudo": true }, + { + "long": "-percent-type", + "desc": "Set the percentage output type", + "remark": [ + "0 for use global `--percent-type` value", + "1 for percentage number", + "2 for multi-color bar", + "3 for both", + "6 for bar only", + "9 for colored number", + "10 for monochrome bar" + ], + "arg": { + "type": "num", + "default": 0 + }, + "pseudo": true + }, { "long": "-temp-green", "desc": [