mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
add term:localshellopts (#914)
This commit is contained in:
parent
8cfbd2426b
commit
2fa88c4e50
2
frontend/types/gotypes.d.ts
vendored
2
frontend/types/gotypes.d.ts
vendored
@ -302,6 +302,7 @@ declare global {
|
||||
"term:mode"?: string;
|
||||
"term:theme"?: string;
|
||||
"term:localshellpath"?: string;
|
||||
"term:localshellopts"?: string[];
|
||||
count?: number;
|
||||
};
|
||||
|
||||
@ -419,6 +420,7 @@ declare global {
|
||||
"term:fontfamily"?: string;
|
||||
"term:disablewebgl"?: boolean;
|
||||
"term:localshellpath"?: string;
|
||||
"term:localshellopts"?: string[];
|
||||
"editor:minimapenabled"?: boolean;
|
||||
"editor:stickyscrollenabled"?: boolean;
|
||||
"web:*"?: boolean;
|
||||
|
@ -302,6 +302,12 @@ func (bc *BlockController) DoRunShellCommand(rc *RunShellOpts, blockMeta waveobj
|
||||
if blockMeta.GetString(waveobj.MetaKey_TermLocalShellPath, "") != "" {
|
||||
cmdOpts.ShellPath = blockMeta.GetString(waveobj.MetaKey_TermLocalShellPath, "")
|
||||
}
|
||||
if len(settings.TermLocalShellOpts) > 0 {
|
||||
cmdOpts.ShellOpts = append([]string{}, settings.TermLocalShellOpts...)
|
||||
}
|
||||
if len(blockMeta.GetStringList(waveobj.MetaKey_TermLocalShellOpts)) > 0 {
|
||||
cmdOpts.ShellOpts = append([]string{}, blockMeta.GetStringList(waveobj.MetaKey_TermLocalShellOpts)...)
|
||||
}
|
||||
shellProc, err = shellexec.StartShellProc(rc.TermSize, cmdStr, cmdOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -35,6 +35,7 @@ type CommandOptsType struct {
|
||||
Cwd string `json:"cwd,omitempty"`
|
||||
Env map[string]string `json:"env,omitempty"`
|
||||
ShellPath string `json:"shellPath,omitempty"`
|
||||
ShellOpts []string `json:"shellOpts,omitempty"`
|
||||
}
|
||||
|
||||
type ShellProc struct {
|
||||
@ -159,6 +160,7 @@ func StartRemoteShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts Comm
|
||||
log.Printf("error installing rc files: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
shellOpts = append(shellOpts, cmdOpts.ShellOpts...)
|
||||
|
||||
homeDir := remote.GetHomeDir(client)
|
||||
|
||||
@ -280,6 +282,7 @@ func StartShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts CommandOpt
|
||||
if shellPath == "" {
|
||||
shellPath = shellutil.DetectLocalShellPath()
|
||||
}
|
||||
shellOpts = append(shellOpts, cmdOpts.ShellOpts...)
|
||||
if cmdStr == "" {
|
||||
if isBashShell(shellPath) {
|
||||
// add --rcfile
|
||||
|
@ -60,6 +60,7 @@ const (
|
||||
MetaKey_TermMode = "term:mode"
|
||||
MetaKey_TermTheme = "term:theme"
|
||||
MetaKey_TermLocalShellPath = "term:localshellpath"
|
||||
MetaKey_TermLocalShellOpts = "term:localshellopts"
|
||||
|
||||
MetaKey_Count = "count"
|
||||
)
|
||||
|
@ -14,6 +14,24 @@ func (m MetaMapType) GetString(key string, def string) string {
|
||||
return def
|
||||
}
|
||||
|
||||
func (m MetaMapType) GetStringList(key string) []string {
|
||||
v, ok := m[key]
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
varr, ok := v.([]any)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
rtn := make([]string, 0)
|
||||
for _, varrVal := range varr {
|
||||
if s, ok := varrVal.(string); ok {
|
||||
rtn = append(rtn, s)
|
||||
}
|
||||
}
|
||||
return rtn
|
||||
}
|
||||
|
||||
func (m MetaMapType) GetBool(key string, def bool) bool {
|
||||
if v, ok := m[key]; ok {
|
||||
if b, ok := v.(bool); ok {
|
||||
|
@ -54,12 +54,13 @@ type MetaTSType struct {
|
||||
BgOpacity float64 `json:"bg:opacity,omitempty"`
|
||||
BgBlendMode string `json:"bg:blendmode,omitempty"`
|
||||
|
||||
TermClear bool `json:"term:*,omitempty"`
|
||||
TermFontSize int `json:"term:fontsize,omitempty"`
|
||||
TermFontFamily string `json:"term:fontfamily,omitempty"`
|
||||
TermMode string `json:"term:mode,omitempty"`
|
||||
TermTheme string `json:"term:theme,omitempty"`
|
||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"` // matches settings
|
||||
TermClear bool `json:"term:*,omitempty"`
|
||||
TermFontSize int `json:"term:fontsize,omitempty"`
|
||||
TermFontFamily string `json:"term:fontfamily,omitempty"`
|
||||
TermMode string `json:"term:mode,omitempty"`
|
||||
TermTheme string `json:"term:theme,omitempty"`
|
||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"` // matches settings
|
||||
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"` // matches settings
|
||||
|
||||
Count int `json:"count,omitempty"` // temp for cpu plot. will remove later
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ const (
|
||||
ConfigKey_TermFontFamily = "term:fontfamily"
|
||||
ConfigKey_TermDisableWebGl = "term:disablewebgl"
|
||||
ConfigKey_TermLocalShellPath = "term:localshellpath"
|
||||
ConfigKey_TermLocalShellOpts = "term:localshellopts"
|
||||
|
||||
ConfigKey_EditorMinimapEnabled = "editor:minimapenabled"
|
||||
ConfigKey_EditorStickyScrollEnabled = "editor:stickyscrollenabled"
|
||||
|
@ -48,11 +48,12 @@ type SettingsType struct {
|
||||
AiMaxTokens float64 `json:"ai:maxtokens,omitempty"`
|
||||
AiTimeoutMs float64 `json:"ai:timeoutms,omitempty"`
|
||||
|
||||
TermClear bool `json:"term:*,omitempty"`
|
||||
TermFontSize float64 `json:"term:fontsize,omitempty"`
|
||||
TermFontFamily string `json:"term:fontfamily,omitempty"`
|
||||
TermDisableWebGl bool `json:"term:disablewebgl,omitempty"`
|
||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"`
|
||||
TermClear bool `json:"term:*,omitempty"`
|
||||
TermFontSize float64 `json:"term:fontsize,omitempty"`
|
||||
TermFontFamily string `json:"term:fontfamily,omitempty"`
|
||||
TermDisableWebGl bool `json:"term:disablewebgl,omitempty"`
|
||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"`
|
||||
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"`
|
||||
|
||||
EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"`
|
||||
EditorStickyScrollEnabled bool `json:"editor:stickyscrollenabled,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user