Help: fix json text loading

This commit is contained in:
李通洲
2023-12-06 23:55:34 +08:00
parent 30b9f95b49
commit bd40205427
2 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -206,7 +206,7 @@ endif()
#############
function(fastfetch_encode_c_string STR OUTVAR)
string(REGEX REPLACE "\n$" "" TEMP "${STR}") # Remove trailing newline
string(REGEX REPLACE "\n$" "" TEMP "${STR}") # Remove trailing newline
string(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashes
string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n
string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"
@@ -222,7 +222,7 @@ endfunction(fastfetch_load_text)
find_package(Python)
if(Python_FOUND)
# Minify JSON string. `io.open(0,encoding='utf-8')` is needed to avoid encoding issues on Windows
execute_process(COMMAND ${Python_EXECUTABLE} -c "import io,json,sys;json.dump(json.load(io.open(0,encoding='utf-8')),sys.stdout,separators=(',', ':'),ensure_ascii=False)"
execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json"
OUTPUT_VARIABLE DATATEXT_JSON_HELP)
else()
+7 -7
View File
@@ -548,7 +548,7 @@
"desc": "Set the character to use in elapsed part of percentage bars",
"arg": {
"type": "str",
"default": ""
"default": "\u25a0"
}
},
{
@@ -1290,12 +1290,12 @@
"arg": {
"type": "enum",
"enum": {
"block": "███",
"circle": "",
"diamond": "",
"triangle": "",
"square": "",
"star": ""
"block": "\u2588\u2588\u2588",
"circle": "\u25cf",
"diamond": "\u25c6",
"triangle": "\u25b2",
"square": "\u25a0",
"star": "\u2605"
},
"default": "block"
}