-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
129 lines (102 loc) · 2.27 KB
/
index.d.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
type FlagTypes = 'boolean' | 'string' | 'number'
interface Flag {
/**
* Defines the flag type
* this is the type of the returning parsed flag value
*/
type: FlagTypes
/**
* Defines the flag description
* used in built-in help message generation
*/
description?: string
/**
* Defines the flag alias
*/
alias?: string
/**
* Defines the flag default values in case is empty
*/
default?: any
/**
* Defines a custom option argument validation function
* if the function return false or string
* a validation error is raised
*/
validation?: (input: string) => boolean | string
/**
* Defines the flag as required
* if values is undefined after parsing
* it will raise an error
*/
required?: boolean
/**
* Defines the flag as multiple
* and it's parsed as an array
*/
multiple?: boolean
}
interface FlagsMap {
[key: string]: Flag
}
export interface Options {
/**
* The command flags definitions
*/
flags: FlagsMap
/**
* Set the command banner
* displayed in in built-in help message
* on top of other help sections
*/
banner?: string
/**
* Set custom usage string
*/
usage?: string
/**
* Set custom command name
* used in usage string and command version
*/
name?: string
/**
* Set custom command version
* used in usage string and command version
*/
version?: string
/**
* Set custom command description
* used in built-in help message
*/
description?: string
/**
* Set custom command examples
* used in built-in help message
*/
examples?: string | string[]
/**
* Set the indentation used in command help message
*/
indentation?: number
/**
* Enable or disable built-in version message
*/
showVersion?: boolean
/**
* Enable or disable built-in help message generation
*/
showHelp?: boolean
}
export interface Result {
/**
* Command input
*/
input: string[]
/**
* Parsed command options
*/
flags: {
[name: string]: any
}
}
export default function clito(options: Options): Result;