Skip to content

Commit

Permalink
Add support for PowerShell 7 (pwsh)
Browse files Browse the repository at this point in the history
  • Loading branch information
siarheiburliayeu committed Mar 12, 2024
1 parent df995c0 commit d2fb79a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'com.sburlyaev.terminal.plugin'
version '0.6.1'
version '0.7.0'

sourceCompatibility = 17

Expand Down Expand Up @@ -38,6 +38,7 @@ patchPluginXml {
which will be replaced at runtime with the actual project directory.
"""
changeNotes = """
<li>Add support for Alacritty terminal emulator</li>
<li>Add support for PowerShell 7 (pwsh)</li>
<li>Fix ActionUpdateThread warnings/li>
"""
}
5 changes: 3 additions & 2 deletions src/main/java/com/sburlyaev/cmd/plugin/CommandBuilder.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sburlyaev.cmd.plugin;

import com.intellij.openapi.diagnostic.Logger;
import com.sburlyaev.cmd.plugin.exception.UnsupportedEnvironmentException;
import com.sburlyaev.cmd.plugin.model.Command;
import com.sburlyaev.cmd.plugin.model.Environment;
import com.sburlyaev.cmd.plugin.model.OperationSystem;
Expand Down Expand Up @@ -49,7 +50,7 @@ public static Command createCommand(@NotNull Environment env,
case COMMAND_PROMPT -> {
return new Command("cmd", "/c", "start", command, "/K", "cd", "/d", projectDirectory);
}
case POWER_SHELL -> {
case POWER_SHELL, POWER_SHELL_7 -> {
return new Command("cmd", "/c", "start", command, "-NoExit", "-Command",
"Set-Location", "'" + projectDirectory + "'");
}
Expand Down Expand Up @@ -101,7 +102,7 @@ public static Command createCommand(@NotNull Environment env,
};
}

default -> throw new RuntimeException("The environment is not supported: " + os);
default -> throw new UnsupportedEnvironmentException("The environment is not supported: " + os);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.sburlyaev.cmd.plugin.exception;

public class UnsupportedEnvironmentException extends RuntimeException {

public UnsupportedEnvironmentException(String message) {
super(message);
}

}
1 change: 1 addition & 0 deletions src/main/java/com/sburlyaev/cmd/plugin/model/Terminal.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public enum Terminal {
WINDOWS_TERMINAL("wt"),
COMMAND_PROMPT("cmd"),
POWER_SHELL("powershell"),
POWER_SHELL_7("pwsh"),
CON_EMU("conemu"),
GIT_BASH("git-bash"),
BASH("bash"),
Expand Down

0 comments on commit d2fb79a

Please sign in to comment.