feat: statusline support script
This commit is contained in:
@@ -50,6 +50,7 @@ const MODULE_TYPES = [
|
||||
{ label: "gitBranch", value: "gitBranch" },
|
||||
{ label: "model", value: "model" },
|
||||
{ label: "usage", value: "usage" },
|
||||
{ label: "script", value: "script" },
|
||||
];
|
||||
|
||||
// ANSI颜色代码映射
|
||||
@@ -675,6 +676,15 @@ export function StatusLineConfigDialog({
|
||||
color: "bright_magenta",
|
||||
};
|
||||
break;
|
||||
case "script":
|
||||
newModule = {
|
||||
type: "script",
|
||||
icon: "📜",
|
||||
text: "Script Module",
|
||||
color: "bright_cyan",
|
||||
scriptPath: "",
|
||||
};
|
||||
break;
|
||||
default:
|
||||
newModule = { ...DEFAULT_MODULE, type: moduleType };
|
||||
}
|
||||
@@ -920,6 +930,31 @@ export function StatusLineConfigDialog({
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Script Path 输入框 - 仅在type为script时显示 */}
|
||||
{selectedModule.type === "script" && (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="module-script-path">
|
||||
脚本路径
|
||||
</Label>
|
||||
<Input
|
||||
id="module-script-path"
|
||||
value={selectedModule.scriptPath || ""}
|
||||
onChange={(e) =>
|
||||
handleModuleChange(
|
||||
selectedModuleIndex,
|
||||
"scriptPath",
|
||||
e.target.value
|
||||
)
|
||||
}
|
||||
placeholder="例如: /path/to/your/script.js"
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
输入Node.js脚本文件的绝对路径
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
<Button
|
||||
variant="destructive"
|
||||
size="sm"
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
"gitBranch": "Git Branch",
|
||||
"model": "Model",
|
||||
"usage": "Usage",
|
||||
"script": "Script",
|
||||
"background_none": "None",
|
||||
"color_black": "Black",
|
||||
"color_red": "Red",
|
||||
|
||||
@@ -135,6 +135,7 @@
|
||||
"gitBranch": "Git分支",
|
||||
"model": "模型",
|
||||
"usage": "使用情况",
|
||||
"script": "脚本",
|
||||
"background_none": "无",
|
||||
"color_black": "黑色",
|
||||
"color_red": "红色",
|
||||
|
||||
@@ -33,6 +33,7 @@ export interface StatusLineModuleConfig {
|
||||
text: string;
|
||||
color?: string;
|
||||
background?: string;
|
||||
scriptPath?: string; // 用于script类型的模块,指定要执行的Node.js脚本文件路径
|
||||
}
|
||||
|
||||
export interface StatusLineThemeConfig {
|
||||
|
||||
Reference in New Issue
Block a user