File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- use clap:: Parser ;
1+ use clap:: { CommandFactory , Parser } ;
2+ use clap_complete:: { generate, Shell } ;
23
34#[ derive( Parser ) ]
45#[ command(
@@ -66,6 +67,8 @@ struct Args {
6667 /// Preview the actions without actually cloning or copying
6768 #[ arg( short = 'n' , long = "dry-run" ) ]
6869 dry_run : bool ,
70+ #[ arg( long, hide = true , exclusive = true ) ]
71+ completions : Option < Shell > ,
6972}
7073
7174#[ cfg( target_os = "windows" ) ]
@@ -296,6 +299,13 @@ mod windows_impl {
296299
297300 let args = Args :: parse ( ) ;
298301
302+ if let Some ( shell) = args. completions {
303+ let mut cmd = Args :: command ( ) ;
304+ let name = cmd. get_name ( ) . to_string ( ) ;
305+ generate ( shell, & mut cmd, name, & mut io:: stdout ( ) ) ;
306+ return Ok ( ( ) ) ;
307+ }
308+
299309 validate_repo_url ( & args. repo ) ?;
300310 validate_distro ( & args. distro ) ?;
301311 if let Some ( ref u) = args. user {
You can’t perform that action at this time.
0 commit comments