@@ -209,6 +209,7 @@ pub struct ShellConfiguration {
209209 pub profile_file : & ' static str ,
210210 pub init_command : & ' static str ,
211211 pub wrapper : & ' static str ,
212+ pub prepend_persist_command : Option < & ' static str > ,
212213 pub extra_instructions : Option < & ' static str > ,
213214}
214215
@@ -236,6 +237,7 @@ impl ShellConfiguration {
236237 profile_file : "$PROFILE" ,
237238 init_command : "csm init powershell --code | Out-String | Invoke-Expression" ,
238239 wrapper : PWSH_WRAPPER ,
240+ prepend_persist_command : Some ( r"md -f $PROFILE\..; " ) ,
239241 extra_instructions : Some ( powershell_extra) ,
240242 } ,
241243 SupportedShell :: Zsh => Self {
@@ -248,7 +250,11 @@ impl ShellConfiguration {
248250 }
249251
250252 fn persist_command ( & self ) -> String {
251- format ! ( "echo '{}' >> {}" , self . init_command, self . profile_file)
253+ let pre = self . prepend_persist_command . unwrap_or_default ( ) ;
254+ format ! (
255+ "{}echo '{}' >> {}" ,
256+ pre, self . init_command, self . profile_file
257+ )
252258 }
253259
254260 pub fn instructions ( & self ) -> String {
0 commit comments