@@ -33,7 +33,7 @@ use std::{
3333
3434use crate :: wpt:: path:: Browser ;
3535use camino:: Utf8PathBuf ;
36- use clap:: { Parser , ValueEnum } ;
36+ use clap:: { CommandFactory , Parser , ValueEnum } ;
3737use enumset:: { EnumSet , EnumSetType } ;
3838use indexmap:: { IndexMap , IndexSet } ;
3939use itertools:: Itertools ;
@@ -145,6 +145,8 @@ enum Subcommand {
145145 /// Dump all metadata as JSON. Do so at your own risk; no guarantees are made about the
146146 /// schema of this JSON, for now.
147147 DumpJson ,
148+ /// Generate completions for various supported shells.
149+ GenerateCompletions { shell : CompletionShell } ,
148150}
149151
150152#[ derive( Clone , Debug , clap:: Args ) ]
@@ -257,6 +259,11 @@ enum UpdateBacklogCriteria {
257259 } ,
258260}
259261
262+ #[ derive( Clone , Copy , Debug , ValueEnum ) ]
263+ enum CompletionShell {
264+ Nushell ,
265+ }
266+
260267fn main ( ) -> ExitCode {
261268 env_logger:: builder ( )
262269 . filter_level ( log:: LevelFilter :: Info )
@@ -1110,6 +1117,20 @@ fn run(cli: Cli) -> ExitCode {
11101117 }
11111118 }
11121119 }
1120+ Subcommand :: GenerateCompletions { shell } => {
1121+ let generator = match shell {
1122+ CompletionShell :: Nushell => clap_complete_nushell:: Nushell ,
1123+ } ;
1124+
1125+ clap_complete:: generate (
1126+ generator,
1127+ & mut Cli :: command ( ) ,
1128+ env ! ( "CARGO_BIN_NAME" ) ,
1129+ & mut io:: stdout ( ) ,
1130+ ) ;
1131+
1132+ ExitCode :: SUCCESS
1133+ }
11131134 }
11141135}
11151136
0 commit comments