@@ -36,13 +36,31 @@ fn main() {
36
36
}
37
37
} ,
38
38
( "setup" , Some ( sub_command) ) => match sub_command. subcommand ( ) {
39
- ( "intellij" , Some ( matches) ) => setup:: intellij:: setup_rustc_src (
40
- matches
41
- . value_of ( "rustc-repo-path" )
42
- . expect ( "this field is mandatory and therefore always valid" ) ,
43
- ) ,
44
- ( "git-hook" , Some ( matches) ) => setup:: git_hook:: install_hook ( matches. is_present ( "force-override" ) ) ,
45
- ( "vscode-tasks" , Some ( matches) ) => setup:: vscode:: install_tasks ( matches. is_present ( "force-override" ) ) ,
39
+ ( "intellij" , Some ( matches) ) => {
40
+ if matches. is_present ( "remove" ) {
41
+ setup:: intellij:: remove_rustc_src ( ) ;
42
+ } else {
43
+ setup:: intellij:: setup_rustc_src (
44
+ matches
45
+ . value_of ( "rustc-repo-path" )
46
+ . expect ( "this field is mandatory and therefore always valid" ) ,
47
+ ) ;
48
+ }
49
+ } ,
50
+ ( "git-hook" , Some ( matches) ) => {
51
+ if matches. is_present ( "remove" ) {
52
+ setup:: git_hook:: remove_hook ( ) ;
53
+ } else {
54
+ setup:: git_hook:: install_hook ( matches. is_present ( "force-override" ) ) ;
55
+ }
56
+ } ,
57
+ ( "vscode-tasks" , Some ( matches) ) => {
58
+ if matches. is_present ( "remove" ) {
59
+ setup:: vscode:: remove_tasks ( ) ;
60
+ } else {
61
+ setup:: vscode:: install_tasks ( matches. is_present ( "force-override" ) ) ;
62
+ }
63
+ } ,
46
64
_ => { } ,
47
65
} ,
48
66
( "remove" , Some ( sub_command) ) => match sub_command. subcommand ( ) {
@@ -167,19 +185,32 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
167
185
. subcommand (
168
186
SubCommand :: with_name ( "intellij" )
169
187
. about ( "Alter dependencies so Intellij Rust can find rustc internals" )
188
+ . arg (
189
+ Arg :: with_name ( "remove" )
190
+ . long ( "remove" )
191
+ . help ( "Remove the dependencies added with 'cargo dev setup intellij'" )
192
+ . required ( false ) ,
193
+ )
170
194
. arg (
171
195
Arg :: with_name ( "rustc-repo-path" )
172
196
. long ( "repo-path" )
173
197
. short ( "r" )
174
198
. help ( "The path to a rustc repo that will be used for setting the dependencies" )
175
199
. takes_value ( true )
176
200
. value_name ( "path" )
201
+ . conflicts_with ( "remove" )
177
202
. required ( true ) ,
178
203
) ,
179
204
)
180
205
. subcommand (
181
206
SubCommand :: with_name ( "git-hook" )
182
207
. about ( "Add a pre-commit git hook that formats your code to make it look pretty" )
208
+ . arg (
209
+ Arg :: with_name ( "remove" )
210
+ . long ( "remove" )
211
+ . help ( "Remove the pre-commit hook added with 'cargo dev setup git-hook'" )
212
+ . required ( false ) ,
213
+ )
183
214
. arg (
184
215
Arg :: with_name ( "force-override" )
185
216
. long ( "force-override" )
@@ -191,6 +222,12 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
191
222
. subcommand (
192
223
SubCommand :: with_name ( "vscode-tasks" )
193
224
. about ( "Add several tasks to vscode for formatting, validation and testing" )
225
+ . arg (
226
+ Arg :: with_name ( "remove" )
227
+ . long ( "remove" )
228
+ . help ( "Remove the tasks added with 'cargo dev setup vscode-tasks'" )
229
+ . required ( false ) ,
230
+ )
194
231
. arg (
195
232
Arg :: with_name ( "force-override" )
196
233
. long ( "force-override" )
0 commit comments