1
1
use clap_complete:: { Shell as ClapCompleteShell , aot:: Generator } ;
2
+ use clap_complete_fig:: Fig as ClapFig ;
2
3
use clap_complete_nushell:: Nushell ;
3
4
4
5
#[ derive( Clone , Copy ) ]
5
6
pub enum Shell {
6
7
ClapCompleteShell ( ClapCompleteShell ) ,
7
8
Nushell ,
9
+ Fig ,
8
10
}
9
11
10
12
impl clap:: ValueEnum for Shell {
@@ -16,13 +18,15 @@ impl clap::ValueEnum for Shell {
16
18
Self :: ClapCompleteShell ( ClapCompleteShell :: PowerShell ) ,
17
19
Self :: ClapCompleteShell ( ClapCompleteShell :: Elvish ) ,
18
20
Self :: Nushell ,
21
+ Self :: Fig ,
19
22
]
20
23
}
21
24
22
25
fn to_possible_value ( & self ) -> Option < clap:: builder:: PossibleValue > {
23
26
match self {
24
27
Self :: ClapCompleteShell ( shell) => shell. to_possible_value ( ) ,
25
28
Self :: Nushell => Some ( clap:: builder:: PossibleValue :: new ( "nushell" ) ) ,
29
+ Self :: Fig => Some ( clap:: builder:: PossibleValue :: new ( "fig" ) ) ,
26
30
}
27
31
}
28
32
}
@@ -32,13 +36,15 @@ impl Generator for Shell {
32
36
match self {
33
37
Self :: ClapCompleteShell ( shell) => shell. file_name ( name) ,
34
38
Self :: Nushell => Nushell . file_name ( name) ,
39
+ Self :: Fig => ClapFig . file_name ( name) ,
35
40
}
36
41
}
37
42
38
43
fn generate ( & self , cmd : & clap:: Command , buf : & mut dyn std:: io:: Write ) {
39
44
match self {
40
45
Self :: ClapCompleteShell ( shell) => shell. generate ( cmd, buf) ,
41
46
Self :: Nushell => Nushell . generate ( cmd, buf) ,
47
+ Self :: Fig => ClapFig . generate ( cmd, buf) ,
42
48
}
43
49
}
44
50
}
0 commit comments