TerminalShell: add --shell-version and --terminal-version options to disable shell / terminal version detection

in case that users don't like it
This commit is contained in:
李通洲
2023-01-11 17:17:17 +08:00
parent 9dab23b5fc
commit 7145f5252d
9 changed files with 47 additions and 8 deletions
@@ -352,12 +352,17 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
getTerminalFromEnv(&result);
getUserShellFromEnv(instance, &result);
getShellVersion(&result.shellExe, result.shellExeName, &result.shellVersion);
if(strcasecmp(result.shellExeName, result.userShellExeName) != 0)
getShellVersion(&result.userShellExe, result.userShellExeName, &result.userShellVersion);
else
ffStrbufSet(&result.userShellVersion, &result.shellVersion);
ffStrbufClear(&result.shellVersion);
if(instance->config.shellVersion)
{
getShellVersion(&result.shellExe, result.shellExeName, &result.shellVersion);
if(strcasecmp(result.shellExeName, result.userShellExeName) != 0)
getShellVersion(&result.userShellExe, result.userShellExeName, &result.userShellVersion);
else
ffStrbufSet(&result.userShellVersion, &result.shellVersion);
}
if(ffStrbufEqualS(&result.shellProcessName, "pwsh"))
ffStrbufInitS(&result.shellPrettyName, "PowerShell");
@@ -383,7 +388,9 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
ffStrbufInitCopy(&result.terminalPrettyName, &result.terminalProcessName);
ffStrbufInit(&result.terminalVersion);
fftsGetTerminalVersion(&result.terminalProcessName, &result.terminalExe, &result.terminalVersion);
if(instance->config.terminalVersion)
fftsGetTerminalVersion(&result.terminalProcessName, &result.terminalExe, &result.terminalVersion);
ffThreadMutexUnlock(&mutex);
return &result;