File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
zkstack_cli/crates/zkstack Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -112,15 +112,22 @@ impl ShellAutocomplete for clap_complete::Shell {
112112 . context ( format ! ( "could not read .{}rc" , shell) ) ?;
113113
114114 if !shell_rc_content. contains ( "# zkstack completion" ) {
115- std:: fs:: write (
116- shell_rc,
115+ let completion_snippet = if shell == "zsh" {
116+ format ! (
117+ "{}\n # zkstack completion\n autoload -Uz compinit\n compinit\n source \" {}\" \n " ,
118+ shell_rc_content,
119+ completion_file. to_str( ) . unwrap( )
120+ )
121+ } else {
117122 format ! (
118123 "{}\n # zkstack completion\n source \" {}\" \n " ,
119124 shell_rc_content,
120125 completion_file. to_str( ) . unwrap( )
121- ) ,
122- )
123- . context ( format ! ( "could not write .{}rc" , shell) ) ?;
126+ )
127+ } ;
128+
129+ std:: fs:: write ( shell_rc, completion_snippet)
130+ . context ( format ! ( "could not write .{}rc" , shell) ) ?;
124131 }
125132 } else {
126133 println ! (
You can’t perform that action at this time.
0 commit comments