File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,27 @@ import { checkCommand } from './process.js'
33import { getPythonCommand } from './platform.js'
44import type { EnvCheckResult , EnvCheckSummary } from '../types/env.js'
55
6+ function normalizeVersion (
7+ version : string | undefined ,
8+ name : string ,
9+ command : string ,
10+ ) : string | undefined {
11+ if ( ! version ) return version
12+
13+ let normalized = version . trim ( )
14+ const prefixes = [ name , command ]
15+
16+ for ( const prefix of prefixes ) {
17+ const escaped = prefix . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' )
18+ normalized = normalized . replace (
19+ new RegExp ( `^${ escaped } (?:\\s+version)?\\s+` , 'i' ) ,
20+ '' ,
21+ )
22+ }
23+
24+ return normalized
25+ }
26+
627async function checkTool (
728 name : string ,
829 command : string ,
@@ -14,7 +35,7 @@ async function checkTool(
1435 name,
1536 command,
1637 found : result . found ,
17- version : result . version ,
38+ version : normalizeVersion ( result . version , name , command ) ,
1839 required,
1940 }
2041}
You can’t perform that action at this time.
0 commit comments