Display: add option --ts-version to hide terminal and shell version

This commit is contained in:
李通洲
2024-04-18 22:53:31 +08:00
parent 0e7dda4043
commit fd0b35f21a
5 changed files with 26 additions and 4 deletions
+5
View File
@@ -549,6 +549,11 @@
"type": "boolean",
"description": "Whether to disable the stdout application buffer",
"default": false
},
"tsVersion": {
"type": "boolean",
"description": "Whether to detect and display the version of terminal and shell. Mainly for benchmarking",
"default": true
}
}
},
+10
View File
@@ -702,6 +702,16 @@
"type": "color",
"default": "light_red"
}
},
{
"long": "ts-version",
"desc": "Whether to detect and display the version of terminal and shell",
"remark": "Mainly for benchmarking",
"arg": {
"type": "bool",
"optional": true,
"default": true
}
}
],
"Library path": [
@@ -223,6 +223,8 @@ static bool getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf*
bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
{
if (!instance.config.display.tsVersion) return false;
if(strcasecmp(exeName, "bash") == 0 || strcasecmp(exeName, "sh") == 0)
return getShellVersionBash(exe, version);
if(strcasecmp(exeName, "zsh") == 0)
@@ -530,6 +532,8 @@ static bool getTerminalVersionConEmu(FFstrbuf* exe, FFstrbuf* version)
bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version)
{
if (!instance.config.display.tsVersion) return false;
#ifdef __ANDROID__
if(ffStrbufEqualS(processName, "com.termux"))
+6 -4
View File
@@ -189,10 +189,8 @@ const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_va
options->noBuffer = yyjson_get_bool(val);
else if (ffStrEqualsIgnCase(key, "keyWidth"))
options->keyWidth = (uint32_t) yyjson_get_uint(val);
else if (ffStrStartsWithIgnCase(key, "percent"))
return "Property `display.percentX` has been changed to `display.percent.x`";
else if (ffStrStartsWithIgnCase(key, "size"))
return "Property `display.sizeX` has been changed to `display.size.x`";
else if (ffStrEndsWithIgnCase(key, "tsVersion"))
options->tsVersion = yyjson_get_bool(val);
else
return "Unknown display property";
}
@@ -337,6 +335,8 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key
else
return false;
}
else if(ffStrEqualsIgnCase(key, "--ts-version"))
options->tsVersion = ffOptionParseBoolean(value);
else
return false;
return true;
@@ -382,6 +382,8 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options)
ffStrbufInitStatic(&options->percentColorGreen, FF_COLOR_FG_GREEN);
ffStrbufInitStatic(&options->percentColorYellow, FF_COLOR_FG_LIGHT_YELLOW);
ffStrbufInitStatic(&options->percentColorRed, FF_COLOR_FG_LIGHT_RED);
options->tsVersion = true;
}
void ffOptionsDestroyDisplay(FFOptionsDisplay* options)
+1
View File
@@ -50,6 +50,7 @@ typedef struct FFOptionsDisplay
FFstrbuf percentColorRed;
bool noBuffer;
uint32_t keyWidth;
bool tsVersion;
} FFOptionsDisplay;
const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_val* root);