Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/shell/pwsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl Shell for Pwsh {
}}
}}
__enable_mise_chpwd
Remove-Item -Path Function:/__enable_mise_chpwd
Remove-Item -ErrorAction SilentlyContinue -Path Function:/__enable_mise_chpwd

function __enable_mise_prompt {{
if (-not $__mise_pwsh_previous_prompt_function){{
Expand All @@ -103,7 +103,7 @@ impl Shell for Pwsh {
}}
}}
__enable_mise_prompt
Remove-Item -Path Function:/__enable_mise_prompt
Remove-Item -ErrorAction SilentlyContinue -Path Function:/__enable_mise_prompt

_mise_hook
"#});
Expand Down Expand Up @@ -136,7 +136,7 @@ impl Shell for Pwsh {
}}
}}
__enable_mise_command_not_found
Remove-Item -Path Function:/__enable_mise_command_not_found
Remove-Item -ErrorAction SilentlyContinue -Path Function:/__enable_mise_command_not_found
}}
"#});
}
Expand All @@ -145,10 +145,10 @@ impl Shell for Pwsh {

fn deactivate(&self) -> String {
formatdoc! {r#"
Remove-Item function:mise
Remove-Item -Path Env:/MISE_SHELL
Remove-Item -Path Env:/__MISE_WATCH
Remove-Item -Path Env:/__MISE_DIFF
Remove-Item -ErrorAction SilentlyContinue function:mise
Remove-Item -ErrorAction SilentlyContinue -Path Env:/MISE_SHELL
Remove-Item -ErrorAction SilentlyContinue -Path Env:/__MISE_WATCH
Remove-Item -ErrorAction SilentlyContinue -Path Env:/__MISE_DIFF
"#}
}

Expand All @@ -166,7 +166,7 @@ impl Shell for Pwsh {

fn unset_env(&self, k: &str) -> String {
let k = powershell_escape(k.into());
format!("Remove-Item -Path Env:/{k}\n")
format!("Remove-Item -ErrorAction SilentlyContinue -Path Env:/{k}\n")
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/shell/snapshots/mise__shell__pwsh__tests__activate.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
source: src/shell/pwsh.rs
assertion_line: 235
expression: pwsh.activate(opts)
snapshot_kind: text
---
Expand Down Expand Up @@ -72,7 +71,7 @@ function __enable_mise_chpwd{
}
}
__enable_mise_chpwd
Remove-Item -Path Function:/__enable_mise_chpwd
Remove-Item -ErrorAction SilentlyContinue -Path Function:/__enable_mise_chpwd

function __enable_mise_prompt {
if (-not $__mise_pwsh_previous_prompt_function){
Expand All @@ -86,7 +85,7 @@ function __enable_mise_prompt {
}
}
__enable_mise_prompt
Remove-Item -Path Function:/__enable_mise_prompt
Remove-Item -ErrorAction SilentlyContinue -Path Function:/__enable_mise_prompt

_mise_hook
if (-not $__mise_pwsh_command_not_found){
Expand Down Expand Up @@ -115,5 +114,5 @@ if (-not $__mise_pwsh_command_not_found){
}
}
__enable_mise_command_not_found
Remove-Item -Path Function:/__enable_mise_command_not_found
Remove-Item -ErrorAction SilentlyContinue -Path Function:/__enable_mise_command_not_found
}
9 changes: 4 additions & 5 deletions src/shell/snapshots/mise__shell__pwsh__tests__deactivate.snap
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
source: src/shell/pwsh.rs
assertion_line: 208
expression: replace_path(&deactivate)
snapshot_kind: text
---
Remove-Item function:mise
Remove-Item -Path Env:/MISE_SHELL
Remove-Item -Path Env:/__MISE_WATCH
Remove-Item -Path Env:/__MISE_DIFF
Remove-Item -ErrorAction SilentlyContinue function:mise
Remove-Item -ErrorAction SilentlyContinue -Path Env:/MISE_SHELL
Remove-Item -ErrorAction SilentlyContinue -Path Env:/__MISE_WATCH
Remove-Item -ErrorAction SilentlyContinue -Path Env:/__MISE_DIFF
3 changes: 1 addition & 2 deletions src/shell/snapshots/mise__shell__pwsh__tests__unset_env.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
source: src/shell/pwsh.rs
assertion_line: 178
expression: "Pwsh::default().unset_env(\"FOO\")"
snapshot_kind: text
---
Remove-Item -Path Env:/FOO
Remove-Item -ErrorAction SilentlyContinue -Path Env:/FOO
Loading