-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathget-version-command.ts
More file actions
37 lines (34 loc) · 900 Bytes
/
get-version-command.ts
File metadata and controls
37 lines (34 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const commandMap: Record<string, { command: string; name: string; regex: RegExp }> = {
adb: {
command: 'adb --version',
name: 'Adb ',
regex: /Version (\d+\.\d+\.\d+)/,
},
anchor: {
command: 'anchor --version',
name: 'Anchor',
regex: /anchor-cli (\d+\.\d+\.\d+)/,
},
avm: {
command: 'avm --version',
name: 'AVM ',
regex: /avm (\d+\.\d+\.\d+)/,
},
rust: {
command: 'rustc --version',
name: 'Rust ',
regex: /rustc (\d+\.\d+\.\d+)/,
},
solana: {
command: 'solana --version',
name: 'Solana',
regex: /solana-cli (\d+\.\d+\.\d+)/,
},
}
export type VersionCommand = keyof typeof commandMap
export function getVersionCommand(command: VersionCommand): { command: string; name: string; regex: RegExp } {
return commandMap[command]
}
export function getVersionCommandNames(): string[] {
return Object.keys(commandMap)
}