terminal: move bash integration to shell-integrations folder (IJ-CR-107365)

GitOrigin-RevId: 1a82bdc56211848e3c7f45d15e13ae2927e84185
This commit is contained in:
Sergey Simonchik
2023-05-17 15:43:20 +00:00
committed by intellij-monorepo-bot
parent 93dad6c980
commit 5adb20dcc6
7 changed files with 8 additions and 9 deletions
@@ -230,7 +230,6 @@ object CommunityRepositoryModules {
plugin("intellij.terminal") { spec ->
spec.withResource("resources/zsh/.zshenv", "zsh")
spec.withResource("resources/zsh/hooks.zsh", "zsh")
spec.withResource("resources/bash/jediterm-bash.in", "bash")
spec.withResource("resources/fish/init.fish", "fish")
spec.withResource("resources/pwsh/pwsh.ps1", "pwsh")
spec.withResource("resources/shell-integrations", "shell-integrations")
@@ -92,7 +92,7 @@ function configureCommandHistory {
configureCommandHistory
JETBRAINS_INTELLIJ_BASH_DIR="$(dirname "${BASH_SOURCE[0]}")"
if [ -r "${JETBRAINS_INTELLIJ_BASH_DIR}/hooks.bash" ]; then
source "${JETBRAINS_INTELLIJ_BASH_DIR}/hooks.bash"
if [ -r "${JETBRAINS_INTELLIJ_BASH_DIR}/command-block-support.bash" ]; then
source "${JETBRAINS_INTELLIJ_BASH_DIR}/command-block-support.bash"
fi
unset JETBRAINS_INTELLIJ_BASH_DIR
@@ -20,7 +20,7 @@ public abstract class LocalTerminalCustomizer {
* @param envs mutable map of environment variables
* @return new command to run. Original {@code command} should be returned if no alterations performed
* @apiNote terminal starting shell session with user-specified shell. Under the hood we are running shell with custom rcfile, e.g.:
* {@code /usr/bin/bash --rcfile PATH_TO/community/plugins/terminal/resources/bash/jediterm-bash.in}. See the {@code jediterm-bash.in} script
* {@code /usr/bin/bash --rcfile PATH_TO/bash-integration.bash}. See the {@code bash-integration.bash} script
* for more information on how to alter the execution process.
*/
public String[] customizeCommandAndEnvironment(@NotNull Project project,
@@ -79,7 +79,7 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
@Nullable
private static String findRCFile(@NotNull String shellName) {
String rcfile = switch (shellName) {
case BASH_NAME, SH_NAME -> "bash/jediterm-bash.in";
case BASH_NAME, SH_NAME -> "shell-integrations/bash/bash-integration.bash";
case ZSH_NAME -> "zsh/.zshenv";
case FISH_NAME -> "fish/init.fish";
default -> null;
@@ -33,10 +33,10 @@ public class TerminalShellCommandTest extends TestCase {
public void testAddRcConfig() {
if (SystemInfo.isUnix) {
hasRcConfig("bash -i", "bash/jediterm-bash.in", Maps.newHashMap());
hasRcConfig("bash --login", "bash/jediterm-bash.in", Maps.newHashMap());
hasRcConfig("bash -i", "bash/bash-integration.bash", Maps.newHashMap());
hasRcConfig("bash --login", "bash/bash-integration.bash", Maps.newHashMap());
Map<String, String> envs = Maps.newHashMap();
hasRcConfig("bash --rcfile ~/.bashrc", "bash/jediterm-bash.in", envs);
hasRcConfig("bash --rcfile ~/.bashrc", "bash/bash-integration.bash", envs);
assertTrue(envs.get("JEDITERM_USER_RCFILE").contains(".bashrc"));
}
}
@@ -101,7 +101,7 @@ class PyVirtualEnvTerminalCustomizer : LocalTerminalCustomizer() {
}
if (isShellIntegrationAvailable(shellPath)) { //fish shell works only for virtualenv and not for conda
//for bash we pass activate script to jediterm shell integration (see jediterm-bash.in) to source it there
//for bash we pass activate script to shell integration (see bash-integration.bash) to source it there
//TODO: fix conda for fish [also in fleet.language.python.PythonVirtualEnvTerminalPreprocessor#preprocess]
findActivateScript(sdkHomePath.path, shellPath)?.let { activate ->