File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ struct Opt {
1313 pid : Option < u32 > ,
1414
1515 /// Generate shell completions for the given shell.
16- #[ structopt( long = "completions" ) ]
16+ #[ structopt( long = "completions" , conflicts_with = "pid" ) ]
1717 completions : Option < structopt:: clap:: Shell > ,
1818
1919 #[ structopt( flatten) ]
@@ -26,8 +26,18 @@ fn main() -> anyhow::Result<()> {
2626 let opt = Opt :: from_args ( ) ;
2727
2828 if let Some ( shell) = opt. completions {
29- Opt :: clap ( ) . gen_completions_to ( "flamegraph" , shell, & mut std:: io:: stdout ( ) . lock ( ) ) ;
30- return Ok ( ( ) ) ;
29+ return match opt. trailing_arguments . is_empty ( ) {
30+ true => Ok ( Opt :: clap ( ) . gen_completions_to (
31+ "flamegraph" ,
32+ shell,
33+ & mut std:: io:: stdout ( ) . lock ( ) ,
34+ ) ) ,
35+ false => {
36+ return Err ( anyhow ! (
37+ "command arguments cannot be used with --completions <completions>"
38+ ) )
39+ }
40+ } ;
3141 }
3242
3343 let workload = match ( opt. pid , opt. trailing_arguments . is_empty ( ) ) {
You can’t perform that action at this time.
0 commit comments