Skip to content

Commit 2ae6b26

Browse files
Micro66qdaxb
authored andcommitted
refactor: Optimize the comments in WeCoderTerminalCustomizer to improve readability.
1 parent 6cc521a commit 2ae6b26

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

jetbrains_plugin/src/main/kotlin/com/sina/weibo/agent/terminal/WeCoderTerminalCustomizer.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,28 +168,28 @@ class WeCoderTerminalCustomizer : LocalTerminalCustomizer() {
168168
envs: MutableMap<String, String>,
169169
scriptPath: String
170170
): Array<String> {
171-
// 1) 如果 JetBrains 自带的 zsh shell integration 已经在场,就不要去改 ZDOTDIR,避免冲突
171+
// 1) If JetBrains' built-in zsh shell integration is already in place, avoid modifying ZDOTDIR to prevent conflicts.
172172
val jetbrainsZshDir = envs["JETBRAINS_INTELLIJ_ZSH_DIR"] ?: System.getenv("JETBRAINS_INTELLIJ_ZSH_DIR")
173173
val shellExeName = File(command[0]).name
174174
val looksLikeJbZsh = command[0].contains("/plugins/terminal/shell-integrations/zsh")
175175

176176
if (jetbrainsZshDir != null || looksLikeJbZsh) {
177177
logger.info("🔒 Detected JetBrains Zsh integration (JETBRAINS_INTELLIJ_ZSH_DIR=$jetbrainsZshDir, looksLikeJbZsh=$looksLikeJbZsh). Skip overriding ZDOTDIR.")
178-
// 仍然保留用户原始 ZDOTDIR 到环境,便于脚本内按需使用
178+
// Still retain the user's original ZDOTDIR in the environment for on-demand use within scripts.
179179
val userZdotdir = envs["ZDOTDIR"] ?: System.getenv("ZDOTDIR") ?: System.getProperty("user.home")
180180
envs["USER_ZDOTDIR"] = userZdotdir
181181
return command
182182
}
183183

184-
// 2) 只有当 scriptPath 看起来是一个有效的 ZDOTDIR(至少包含 .zshrc)时才注入
184+
// 2) Inject only when `scriptPath` appears to be a valid `ZDOTDIR` (at least containing `.zshrc`).
185185
val dir = File(scriptPath)
186186
val hasZshrc = File(dir, ".zshrc").exists()
187187
if (!dir.isDirectory || !hasZshrc) {
188188
logger.warn("🚫 Zsh script dir '$scriptPath' is invalid (dir=$dir, hasZshrc=$hasZshrc). Skip overriding ZDOTDIR.")
189189
return command
190190
}
191191

192-
// 3) 记录并安全覆写
192+
// 3) Record and securely overwrite.
193193
val userZdotdir = envs["ZDOTDIR"] ?: System.getenv("ZDOTDIR") ?: System.getProperty("user.home")
194194
envs["USER_ZDOTDIR"] = userZdotdir
195195
envs["ZDOTDIR"] = scriptPath

0 commit comments

Comments
 (0)