@@ -505,15 +505,15 @@ async fn main() -> eyre::Result<()> {
505
505
} ,
506
506
WormholeCommand :: Completion { shell } => {
507
507
let mut cmd = WormholeCli :: command ( ) ;
508
- let binary_name = cmd . get_name ( ) . to_string ( ) ;
508
+ let binary_name = env ! ( "CARGO_BIN_NAME" ) ;
509
509
510
510
match shell {
511
511
shell @ clap_complete:: Shell :: Zsh => {
512
512
// for zsh, we will wrap the output to make it easier to use
513
513
// this way we can source it directly `source <(wormhole-rs completion zsh)`
514
514
515
515
let mut out = Vec :: new ( ) ;
516
- clap_complete:: generate ( shell, & mut cmd, & binary_name, & mut out) ;
516
+ clap_complete:: generate ( shell, & mut cmd, binary_name, & mut out) ;
517
517
let out = String :: from_utf8 ( out)
518
518
. expect ( "Internal error: shell completion not UTF-8 encoded" ) ;
519
519
let out = format ! (
@@ -1196,10 +1196,10 @@ mod test {
1196
1196
1197
1197
for shell in clap_complete:: Shell :: value_variants ( ) {
1198
1198
let mut cmd = WormholeCli :: command ( ) ;
1199
- let binary_name = cmd . get_name ( ) . to_string ( ) ;
1199
+ let binary_name = env ! ( "CARGO_BIN_NAME" ) ;
1200
1200
1201
1201
let mut out = Vec :: new ( ) ;
1202
- clap_complete:: generate ( * shell, & mut cmd, & binary_name, & mut out) ;
1202
+ clap_complete:: generate ( * shell, & mut cmd, binary_name, & mut out) ;
1203
1203
String :: from_utf8 ( out) . unwrap ( ) ;
1204
1204
}
1205
1205
}
0 commit comments