@@ -508,15 +508,15 @@ async fn main() -> eyre::Result<()> {
508
508
} ,
509
509
WormholeCommand :: Completion { shell } => {
510
510
let mut cmd = WormholeCli :: command ( ) ;
511
- let binary_name = cmd . get_name ( ) . to_string ( ) ;
511
+ let binary_name = env ! ( "CARGO_BIN_NAME" ) ;
512
512
513
513
match shell {
514
514
shell @ clap_complete:: Shell :: Zsh => {
515
515
// for zsh, we will wrap the output to make it easier to use
516
516
// this way we can source it directly `source <(wormhole-rs completion zsh)`
517
517
518
518
let mut out = Vec :: new ( ) ;
519
- clap_complete:: generate ( shell, & mut cmd, & binary_name, & mut out) ;
519
+ clap_complete:: generate ( shell, & mut cmd, binary_name, & mut out) ;
520
520
let out = String :: from_utf8 ( out)
521
521
. expect ( "Internal error: shell completion not UTF-8 encoded" ) ;
522
522
let out = format ! (
@@ -1208,10 +1208,10 @@ mod test {
1208
1208
1209
1209
for shell in clap_complete:: Shell :: value_variants ( ) {
1210
1210
let mut cmd = WormholeCli :: command ( ) ;
1211
- let binary_name = cmd . get_name ( ) . to_string ( ) ;
1211
+ let binary_name = env ! ( "CARGO_BIN_NAME" ) ;
1212
1212
1213
1213
let mut out = Vec :: new ( ) ;
1214
- clap_complete:: generate ( * shell, & mut cmd, & binary_name, & mut out) ;
1214
+ clap_complete:: generate ( * shell, & mut cmd, binary_name, & mut out) ;
1215
1215
String :: from_utf8 ( out) . unwrap ( ) ;
1216
1216
}
1217
1217
}
0 commit comments