@@ -4,16 +4,16 @@ use super::Command;
44use crate :: err:: Error ;
55use async_trait:: async_trait;
66use clap:: { Arg , ArgAction , ArgMatches , Command as ClapCommand } ;
7- use clap_complete:: { generate , Generator , Shell } ;
7+ use clap_complete:: { Generator , Shell , generate } ;
88
99/// Abstract shell completions command
1010///
1111/// ```sh
1212/// Generate shell Completions
13-
13+ ///
1414/// USAGE:
1515/// leetcode completions <shell>
16-
16+ ///
1717/// ARGUMENTS:
1818/// <shell> [possible values: bash, elvish, fish, powershell, zsh]
1919/// ```
@@ -36,15 +36,20 @@ impl Command for CompletionCommand {
3636 async fn handler ( _m : & ArgMatches ) -> Result < ( ) , Error > {
3737 // defining custom handler to print the completions. Handler method signature limits taking
3838 // other params. We need &ArgMatches and &mut ClapCommand to generate completions.
39- println ! ( "Don't use this handler. Does not implement the functionality to print completions. Use completions_handler() below." ) ;
39+ println ! (
40+ "Don't use this handler. Does not implement the functionality to print completions. Use completions_handler() below."
41+ ) ;
4042 Ok ( ( ) )
4143 }
4244}
4345
44- fn get_completions_string < G : Generator > ( gen : G , cmd : & mut ClapCommand ) -> Result < String , Error > {
46+ fn get_completions_string < G : Generator > (
47+ generator : G ,
48+ cmd : & mut ClapCommand ,
49+ ) -> Result < String , Error > {
4550 let mut v: Vec < u8 > = Vec :: new ( ) ;
4651 let name = cmd. get_name ( ) . to_string ( ) ;
47- generate ( gen , cmd, name, & mut v) ;
52+ generate ( generator , cmd, name, & mut v) ;
4853 Ok ( String :: from_utf8 ( v) ?)
4954}
5055
0 commit comments