@@ -46,6 +46,13 @@ fn main() {
46
46
}
47
47
} ,
48
48
Some ( ( "setup" , sub_command) ) => match sub_command. subcommand ( ) {
49
+ Some ( ( "git-hook" , matches) ) => {
50
+ if matches. get_flag ( "remove" ) {
51
+ setup:: git_hook:: remove_hook ( ) ;
52
+ } else {
53
+ setup:: git_hook:: install_hook ( matches. get_flag ( "force-override" ) ) ;
54
+ }
55
+ } ,
49
56
Some ( ( "intellij" , matches) ) => {
50
57
if matches. get_flag ( "remove" ) {
51
58
setup:: intellij:: remove_rustc_src ( ) ;
@@ -57,12 +64,12 @@ fn main() {
57
64
) ;
58
65
}
59
66
} ,
60
- Some ( ( "git-hook " , matches) ) => {
61
- if matches . get_flag ( "remove" ) {
62
- setup :: git_hook :: remove_hook ( ) ;
63
- } else {
64
- setup :: git_hook :: install_hook ( matches . get_flag ( "force-override" ) ) ;
65
- }
67
+ Some ( ( "toolchain " , matches) ) => {
68
+ setup :: toolchain :: create (
69
+ matches . get_flag ( "force" ) ,
70
+ matches . get_flag ( "release" ) ,
71
+ matches . get_one :: < String > ( "name" ) . unwrap ( ) ,
72
+ ) ;
66
73
} ,
67
74
Some ( ( "vscode-tasks" , matches) ) => {
68
75
if matches. get_flag ( "remove" ) {
@@ -210,6 +217,19 @@ fn get_clap_config() -> ArgMatches {
210
217
. about ( "Support for setting up your personal development environment" )
211
218
. arg_required_else_help ( true )
212
219
. subcommands ( [
220
+ Command :: new ( "git-hook" )
221
+ . about ( "Add a pre-commit git hook that formats your code to make it look pretty" )
222
+ . args ( [
223
+ Arg :: new ( "remove" )
224
+ . long ( "remove" )
225
+ . action ( ArgAction :: SetTrue )
226
+ . help ( "Remove the pre-commit hook added with 'cargo dev setup git-hook'" ) ,
227
+ Arg :: new ( "force-override" )
228
+ . long ( "force-override" )
229
+ . short ( 'f' )
230
+ . action ( ArgAction :: SetTrue )
231
+ . help ( "Forces the override of an existing git pre-commit hook" ) ,
232
+ ] ) ,
213
233
Command :: new ( "intellij" )
214
234
. about ( "Alter dependencies so Intellij Rust can find rustc internals" )
215
235
. args ( [
@@ -225,18 +245,23 @@ fn get_clap_config() -> ArgMatches {
225
245
. conflicts_with ( "remove" )
226
246
. required ( true ) ,
227
247
] ) ,
228
- Command :: new ( "git-hook " )
229
- . about ( "Add a pre-commit git hook that formats your code to make it look pretty " )
248
+ Command :: new ( "toolchain " )
249
+ . about ( "Install a rustup toolchain pointing to the local clippy build " )
230
250
. args ( [
231
- Arg :: new ( "remove" )
232
- . long ( "remove" )
233
- . action ( ArgAction :: SetTrue )
234
- . help ( "Remove the pre-commit hook added with 'cargo dev setup git-hook'" ) ,
235
- Arg :: new ( "force-override" )
236
- . long ( "force-override" )
251
+ Arg :: new ( "force" )
252
+ . long ( "force" )
237
253
. short ( 'f' )
238
254
. action ( ArgAction :: SetTrue )
239
- . help ( "Forces the override of an existing git pre-commit hook" ) ,
255
+ . help ( "Override an existing toolchain" ) ,
256
+ Arg :: new ( "release" )
257
+ . long ( "release" )
258
+ . short ( 'r' )
259
+ . action ( ArgAction :: SetTrue )
260
+ . help ( "Point to --release clippy binaries" ) ,
261
+ Arg :: new ( "name" )
262
+ . long ( "name" )
263
+ . default_value ( "clippy" )
264
+ . help ( "The name of the created toolchain" ) ,
240
265
] ) ,
241
266
Command :: new ( "vscode-tasks" )
242
267
. about ( "Add several tasks to vscode for formatting, validation and testing" )
0 commit comments