@@ -46,6 +46,13 @@ fn main() {
4646 }
4747 } ,
4848 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+ } ,
4956 Some ( ( "intellij" , matches) ) => {
5057 if matches. get_flag ( "remove" ) {
5158 setup:: intellij:: remove_rustc_src ( ) ;
@@ -57,12 +64,12 @@ fn main() {
5764 ) ;
5865 }
5966 } ,
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+ ) ;
6673 } ,
6774 Some ( ( "vscode-tasks" , matches) ) => {
6875 if matches. get_flag ( "remove" ) {
@@ -210,6 +217,19 @@ fn get_clap_config() -> ArgMatches {
210217 . about ( "Support for setting up your personal development environment" )
211218 . arg_required_else_help ( true )
212219 . 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+ ] ) ,
213233 Command :: new ( "intellij" )
214234 . about ( "Alter dependencies so Intellij Rust can find rustc internals" )
215235 . args ( [
@@ -225,18 +245,23 @@ fn get_clap_config() -> ArgMatches {
225245 . conflicts_with ( "remove" )
226246 . required ( true ) ,
227247 ] ) ,
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 " )
230250 . 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" )
237253 . short ( 'f' )
238254 . 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" ) ,
240265 ] ) ,
241266 Command :: new ( "vscode-tasks" )
242267 . about ( "Add several tasks to vscode for formatting, validation and testing" )
0 commit comments