mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 09:58:03 +02:00
TerminalShell: support oils and elvish
This commit is contained in:
@@ -6,6 +6,9 @@ Changes:
|
||||
* Fastfetch now searchs for config files in the order of `fastfetch --list-config-paths`, and won't load other config if one is found.
|
||||
* Flag `--load-user-config` now works in command line flags, but not in config file.
|
||||
|
||||
Features:
|
||||
* Support Oils and elvish shell version detection (Shell)
|
||||
|
||||
# 2.2.3
|
||||
|
||||
Features:
|
||||
|
||||
@@ -128,6 +128,21 @@ static bool getShellVersionOksh(FFstrbuf* exe, FFstrbuf* version)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool getShellVersionOils(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if(ffProcessAppendStdOut(version, (char* const[]) {
|
||||
exe->chars,
|
||||
"--version",
|
||||
NULL
|
||||
}) != NULL)
|
||||
return false;
|
||||
|
||||
// Oils 0.18.0 https://www.oilshell.org/...
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
ffStrbufSubstrBeforeFirstC(version, '\t');
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool getShellVersionNushell(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
ffStrbufSetS(version, getenv("NU_VERSION"));
|
||||
@@ -170,6 +185,10 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
|
||||
return getShellVersionKsh(exe, version);
|
||||
if(strcasecmp(exeName, "oksh") == 0)
|
||||
return getShellVersionOksh(exe, version);
|
||||
if(strcasecmp(exeName, "oil.ovm") == 0)
|
||||
return getShellVersionOils(exe, version);
|
||||
if(strcasecmp(exeName, "elvish") == 0)
|
||||
return getExeVersionRaw(exe, version);
|
||||
if(strcasecmp(exeName, "python") == 0 && getenv("XONSH_VERSION"))
|
||||
{
|
||||
ffStrbufSetS(version, getenv("XONSH_VERSION"));
|
||||
|
||||
@@ -164,6 +164,8 @@ static void getTerminalShell(FFTerminalShellResult* result, pid_t pid)
|
||||
strcasecmp(name, "pwsh") == 0 ||
|
||||
strcasecmp(name, "nu") == 0 ||
|
||||
strcasecmp(name, "git-shell") == 0 ||
|
||||
strcasecmp(name, "elvish") == 0 ||
|
||||
strcasecmp(name, "oil.ovm") == 0 ||
|
||||
(strcasecmp(name, "python") == 0 && getenv("XONSH_VERSION"))
|
||||
) {
|
||||
if (result->shellProcessName.length == 0)
|
||||
@@ -355,6 +357,8 @@ const FFTerminalShellResult* ffDetectTerminalShell()
|
||||
ffStrbufInitStatic(&result.shellPrettyName, "nushell");
|
||||
else if(ffStrbufIgnCaseEqualS(&result.shellProcessName, "python") && getenv("XONSH_VERSION"))
|
||||
ffStrbufInitStatic(&result.shellPrettyName, "xonsh");
|
||||
else if(ffStrbufIgnCaseEqualS(&result.shellProcessName, "oil.ovm"))
|
||||
ffStrbufInitStatic(&result.shellPrettyName, "Oils");
|
||||
else
|
||||
{
|
||||
// https://github.com/fastfetch-cli/fastfetch/discussions/280#discussioncomment-3831734
|
||||
|
||||
Reference in New Issue
Block a user