merge PR #2183: support Pwsh in Shell Plugin (PowerShell 7.x)

This commit is contained in:
Ioannis G 2023-06-25 07:21:17 +03:00 committed by GitHub
commit 2daed5023f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 3 deletions

View file

@ -237,6 +237,19 @@ namespace Flow.Launcher.Plugin.Shell
break;
}
case Shell.Pwsh:
{
info.FileName = "pwsh.exe";
if (_settings.LeaveShellOpen)
{
info.ArgumentList.Add("-NoExit");
}
info.ArgumentList.Add("-Command");
info.ArgumentList.Add(command);
break;
}
case Shell.RunCommand:
{
var parts = command.Split(new[]

View file

@ -36,6 +36,6 @@ namespace Flow.Launcher.Plugin.Shell
Cmd = 0,
Powershell = 1,
RunCommand = 2,
Pwsh = 3,
}
}

View file

@ -41,6 +41,7 @@
HorizontalAlignment="Left">
<ComboBoxItem>CMD</ComboBoxItem>
<ComboBoxItem>PowerShell</ComboBoxItem>
<ComboBoxItem>Pwsh</ComboBoxItem>
<ComboBoxItem>RunCommand</ComboBoxItem>
</ComboBox>
<StackPanel Grid.Row="4" Orientation="Horizontal">

View file

@ -68,10 +68,23 @@ namespace Flow.Launcher.Plugin.Shell
_settings.ReplaceWinR = false;
};
ShellComboBox.SelectedIndex = (int) _settings.Shell;
ShellComboBox.SelectedIndex = _settings.Shell switch
{
Shell.Cmd => 0,
Shell.Powershell => 1,
Shell.Pwsh => 2,
_ => ShellComboBox.Items.Count - 1
};
ShellComboBox.SelectionChanged += (o, e) =>
{
_settings.Shell = (Shell) ShellComboBox.SelectedIndex;
_settings.Shell = ShellComboBox.SelectedIndex switch
{
0 => Shell.Cmd,
1 => Shell.Powershell,
2 => Shell.Pwsh,
_ => Shell.RunCommand
};
LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand;
};