@@ -67,11 +67,18 @@ const inputs: Array<Inputs> = ["compiler", "architecture", ...tools]
67
67
/** The main entry function */
68
68
export async function main ( args : string [ ] ) : Promise < number > {
69
69
// parse options using mri or github actions
70
- const opts = mri < Record < Inputs , string | undefined > > ( args , {
70
+ const opts = mri < Record < Inputs , string | undefined > & { help : boolean } > ( args , {
71
71
string : inputs ,
72
72
default : Object . fromEntries ( inputs . map ( ( inp ) => [ inp , maybeGetInput ( inp ) ] ) ) ,
73
+ alias : { h : "help" } ,
74
+ boolean : "help" ,
73
75
} )
74
76
77
+ // print help
78
+ if ( opts . help ) {
79
+ printHelp ( )
80
+ }
81
+
75
82
// cpu architecture
76
83
const arch = opts . architecture ?? process . arch
77
84
@@ -164,11 +171,10 @@ export async function main(args: string[]): Promise<number> {
164
171
}
165
172
166
173
// report the messages in the end
167
- console . log ( "\n\n\n" )
168
174
successMessages . forEach ( ( tool ) => core . info ( tool ) )
169
175
errorMessages . forEach ( ( tool ) => core . error ( tool ) )
170
176
171
- core . info ( "install -cpp finished" )
177
+ core . info ( "setup -cpp finished" )
172
178
return errorMessages . length === 0 ? 0 : 1 // exit with non-zero if any error message
173
179
}
174
180
// Run main
@@ -182,6 +188,37 @@ main(process.argv)
182
188
process . exitCode = 1
183
189
} )
184
190
191
+ function printHelp ( ) {
192
+ core . info ( `
193
+ setup-cpp [options]
194
+ setup-cpp --compiler llvm --cmake true --ninja true --ccache true --conan "1.40.1"
195
+
196
+ Install all the tools required for building and testing C++/C projects.
197
+
198
+ --architecture\t the cpu architecture to install the tools for. By default it uses the current CPU architecture.
199
+ --compiler\t the <compiler> to install.
200
+ \t You can specify the version instead of specifying just the name e.g: --compiler 'llvm-11'
201
+
202
+ --tool_name\t pass "true" or pass the <version> you would like to install for this tool.
203
+
204
+ All the available tools:
205
+ --llvm
206
+ --gcc
207
+ --cmake
208
+ --ninja
209
+ --meson
210
+ --conan
211
+ --ccache
212
+ --cppcheck
213
+ --doxygen
214
+ --gcovr
215
+ --opencppcoverage
216
+ --python
217
+ --choco
218
+ --brew
219
+ ` )
220
+ }
221
+
185
222
/** Get an object from github actions */
186
223
function maybeGetInput ( key : string ) {
187
224
const value = core . getInput ( key . toLowerCase ( ) )
0 commit comments