Skip to content

Commit 2899763

Browse files
committed
Shell: improve nu version detection performance
1 parent 72d2ce4 commit 2899763

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/detection/terminalshell/terminalshell.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ static bool getShellVersionOksh(FFstrbuf* exe, FFstrbuf* version)
128128
return true;
129129
}
130130

131+
static bool getShellVersionNushell(FFstrbuf* exe, FFstrbuf* version)
132+
{
133+
ffStrbufSetS(version, getenv("NU_VERSION"));
134+
if (version->length) return true;
135+
return getExeVersionRaw(exe, version); //0.73.0
136+
}
137+
131138
#ifdef _WIN32
132139
static bool getShellVersionWinPowerShell(FFstrbuf* exe, FFstrbuf* version)
133140
{
@@ -158,7 +165,7 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
158165
if(strcasecmp(exeName, "csh") == 0 || strcasecmp(exeName, "tcsh") == 0)
159166
return getExeVersionGeneral(exe, version); //tcsh 6.24.07 (Astron) 2022-12-21 (aarch64-apple-darwin) options wide,nls,dl,al,kan,sm,rh,color,filec
160167
if(strcasecmp(exeName, "nu") == 0)
161-
return getExeVersionRaw(exe, version); //0.73.0
168+
return getShellVersionNushell(exe, version);
162169
if(strcasecmp(exeName, "ksh") == 0)
163170
return getShellVersionKsh(exe, version);
164171
if(strcasecmp(exeName, "oksh") == 0)

0 commit comments

Comments
 (0)