1+ use crate :: BIN_NAME ;
2+ use anyhow:: { Context , Result , anyhow} ;
3+ use clap:: CommandFactory ;
4+ use clap_complete:: { Shell , generate} ;
5+ use crossterm:: style:: Stylize ;
16use std:: {
27 env,
38 fs:: { self , File } ,
@@ -7,11 +12,6 @@ use std::{
712 str:: FromStr ,
813} ;
914
10- use anyhow:: { Context , Result , anyhow} ;
11- use clap:: { CommandFactory , crate_name} ;
12- use clap_complete:: { Shell , generate} ;
13- use crossterm:: style:: Stylize ;
14-
1515use crate :: {
1616 cli:: { self , CompletionsPrintArgs } ,
1717 util:: tty:: Output ,
@@ -26,7 +26,7 @@ pub fn print(args: CompletionsPrintArgs) -> Result<ExitCode> {
2626 let mut cmd = cli:: Args :: command ( ) ;
2727 let mut stdout = io:: stdout ( ) ;
2828
29- generate ( shell, & mut cmd, crate_name ! ( ) , & mut stdout) ;
29+ generate ( shell, & mut cmd, BIN_NAME , & mut stdout) ;
3030
3131 Ok ( ExitCode :: SUCCESS )
3232}
@@ -36,11 +36,11 @@ pub fn update() -> Result<ExitCode> {
3636 let root = get_config_root ( ) ?;
3737
3838 let ( dir_path, filename) = match try_get_shell ( ) ? {
39- Shell :: Zsh => ( root. join ( ".zsh-complete" ) , format ! ( "_{}" , crate_name! ( ) ) ) ,
40- Shell :: Bash => ( root. join ( ".bash_completion.d" ) , String :: from ( crate_name ! ( ) ) ) ,
39+ Shell :: Zsh => ( root. join ( ".zsh-complete" ) , format ! ( "_{}" , BIN_NAME ) ) ,
40+ Shell :: Bash => ( root. join ( ".bash_completion.d" ) , String :: from ( BIN_NAME ) ) ,
4141 Shell :: Fish => (
4242 get_fish_completions_dir ( & root) ,
43- format ! ( "{}.fish" , crate_name! ( ) ) ,
43+ format ! ( "{}.fish" , BIN_NAME ) ,
4444 ) ,
4545 _ => {
4646 Output :: new ( )
@@ -67,7 +67,7 @@ pub fn update() -> Result<ExitCode> {
6767 . with_context ( || format ! ( "failed to create/open {}" , completions_file_path. display( ) ) ) ?;
6868
6969 let mut cmd = cli:: Args :: command ( ) ;
70- generate ( shell, & mut cmd, crate_name ! ( ) , & mut completions_file) ;
70+ generate ( shell, & mut cmd, BIN_NAME , & mut completions_file) ;
7171
7272 let mut out = Output :: new ( ) ;
7373 out. line ( format ! (
0 commit comments