-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.ts
48 lines (36 loc) · 999 Bytes
/
interfaces.ts
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
38
39
40
41
42
43
44
45
46
47
48
export interface Config {
scriptsPath: string
scriptsFile: string
commandSeparator: string
othersCommandsToShow: number
envRegexp: RegExp
checkVersionTimeoutInMs: number
checkVersionIntervalInSeconds: number
}
export type LaunchConfig = Partial<Omit<Config, "scriptsPath" | "scriptsFile">>
export interface ScriptsModule {
default: (helpers: Helpers) => Scripts
config: LaunchConfig
}
export interface Helpers {
cmd: (template: TemplateStringsArray, ...args: string[]) => Builder
}
export interface Scripts {
[name: string]: Script
}
export interface Script {
dir?: string
cmd: Cmd[] | CmdBuilder
desc?: string
}
export type Cmd = string | Builder
export type Builder = (context: Context) => string
export interface Context {
path: string
}
export type CmdBuilder = (_: CmdBuilderContext) => BuiltCmd
export interface CmdBuilderContext {
args: string[]
}
export type BuiltCmd = Cmd[] | { args: string[], cmd: Cmd[] }
export type CmdArg = string | Builder