diff --git a/doc/json_schema.json b/doc/json_schema.json index 387fda5ed..49c0596c7 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -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 } } }, diff --git a/src/data/help.json b/src/data/help.json index b50980800..f7cdfb2ec 100644 --- a/src/data/help.json +++ b/src/data/help.json @@ -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": [ diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 154572179..521ea0bde 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -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")) diff --git a/src/options/display.c b/src/options/display.c index 528c46e80..6744b8f42 100644 --- a/src/options/display.c +++ b/src/options/display.c @@ -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) diff --git a/src/options/display.h b/src/options/display.h index ef02336cb..a56a224e7 100644 --- a/src/options/display.h +++ b/src/options/display.h @@ -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);