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:mode"?: string;
|
||||||
"term:theme"?: string;
|
"term:theme"?: string;
|
||||||
"term:localshellpath"?: string;
|
"term:localshellpath"?: string;
|
||||||
|
"term:localshellopts"?: string[];
|
||||||
count?: number;
|
count?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -419,6 +420,7 @@ declare global {
|
|||||||
"term:fontfamily"?: string;
|
"term:fontfamily"?: string;
|
||||||
"term:disablewebgl"?: boolean;
|
"term:disablewebgl"?: boolean;
|
||||||
"term:localshellpath"?: string;
|
"term:localshellpath"?: string;
|
||||||
|
"term:localshellopts"?: string[];
|
||||||
"editor:minimapenabled"?: boolean;
|
"editor:minimapenabled"?: boolean;
|
||||||
"editor:stickyscrollenabled"?: boolean;
|
"editor:stickyscrollenabled"?: boolean;
|
||||||
"web:*"?: boolean;
|
"web:*"?: boolean;
|
||||||
|
@ -302,6 +302,12 @@ func (bc *BlockController) DoRunShellCommand(rc *RunShellOpts, blockMeta waveobj
|
|||||||
if blockMeta.GetString(waveobj.MetaKey_TermLocalShellPath, "") != "" {
|
if blockMeta.GetString(waveobj.MetaKey_TermLocalShellPath, "") != "" {
|
||||||
cmdOpts.ShellPath = 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)
|
shellProc, err = shellexec.StartShellProc(rc.TermSize, cmdStr, cmdOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -35,6 +35,7 @@ type CommandOptsType struct {
|
|||||||
Cwd string `json:"cwd,omitempty"`
|
Cwd string `json:"cwd,omitempty"`
|
||||||
Env map[string]string `json:"env,omitempty"`
|
Env map[string]string `json:"env,omitempty"`
|
||||||
ShellPath string `json:"shellPath,omitempty"`
|
ShellPath string `json:"shellPath,omitempty"`
|
||||||
|
ShellOpts []string `json:"shellOpts,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShellProc struct {
|
type ShellProc struct {
|
||||||
@ -159,6 +160,7 @@ func StartRemoteShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts Comm
|
|||||||
log.Printf("error installing rc files: %v", err)
|
log.Printf("error installing rc files: %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
shellOpts = append(shellOpts, cmdOpts.ShellOpts...)
|
||||||
|
|
||||||
homeDir := remote.GetHomeDir(client)
|
homeDir := remote.GetHomeDir(client)
|
||||||
|
|
||||||
@ -280,6 +282,7 @@ func StartShellProc(termSize waveobj.TermSize, cmdStr string, cmdOpts CommandOpt
|
|||||||
if shellPath == "" {
|
if shellPath == "" {
|
||||||
shellPath = shellutil.DetectLocalShellPath()
|
shellPath = shellutil.DetectLocalShellPath()
|
||||||
}
|
}
|
||||||
|
shellOpts = append(shellOpts, cmdOpts.ShellOpts...)
|
||||||
if cmdStr == "" {
|
if cmdStr == "" {
|
||||||
if isBashShell(shellPath) {
|
if isBashShell(shellPath) {
|
||||||
// add --rcfile
|
// add --rcfile
|
||||||
|
@ -60,6 +60,7 @@ const (
|
|||||||
MetaKey_TermMode = "term:mode"
|
MetaKey_TermMode = "term:mode"
|
||||||
MetaKey_TermTheme = "term:theme"
|
MetaKey_TermTheme = "term:theme"
|
||||||
MetaKey_TermLocalShellPath = "term:localshellpath"
|
MetaKey_TermLocalShellPath = "term:localshellpath"
|
||||||
|
MetaKey_TermLocalShellOpts = "term:localshellopts"
|
||||||
|
|
||||||
MetaKey_Count = "count"
|
MetaKey_Count = "count"
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,24 @@ func (m MetaMapType) GetString(key string, def string) string {
|
|||||||
return def
|
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 {
|
func (m MetaMapType) GetBool(key string, def bool) bool {
|
||||||
if v, ok := m[key]; ok {
|
if v, ok := m[key]; ok {
|
||||||
if b, ok := v.(bool); ok {
|
if b, ok := v.(bool); ok {
|
||||||
|
@ -60,6 +60,7 @@ type MetaTSType struct {
|
|||||||
TermMode string `json:"term:mode,omitempty"`
|
TermMode string `json:"term:mode,omitempty"`
|
||||||
TermTheme string `json:"term:theme,omitempty"`
|
TermTheme string `json:"term:theme,omitempty"`
|
||||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"` // matches settings
|
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
|
Count int `json:"count,omitempty"` // temp for cpu plot. will remove later
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ const (
|
|||||||
ConfigKey_TermFontFamily = "term:fontfamily"
|
ConfigKey_TermFontFamily = "term:fontfamily"
|
||||||
ConfigKey_TermDisableWebGl = "term:disablewebgl"
|
ConfigKey_TermDisableWebGl = "term:disablewebgl"
|
||||||
ConfigKey_TermLocalShellPath = "term:localshellpath"
|
ConfigKey_TermLocalShellPath = "term:localshellpath"
|
||||||
|
ConfigKey_TermLocalShellOpts = "term:localshellopts"
|
||||||
|
|
||||||
ConfigKey_EditorMinimapEnabled = "editor:minimapenabled"
|
ConfigKey_EditorMinimapEnabled = "editor:minimapenabled"
|
||||||
ConfigKey_EditorStickyScrollEnabled = "editor:stickyscrollenabled"
|
ConfigKey_EditorStickyScrollEnabled = "editor:stickyscrollenabled"
|
||||||
|
@ -53,6 +53,7 @@ type SettingsType struct {
|
|||||||
TermFontFamily string `json:"term:fontfamily,omitempty"`
|
TermFontFamily string `json:"term:fontfamily,omitempty"`
|
||||||
TermDisableWebGl bool `json:"term:disablewebgl,omitempty"`
|
TermDisableWebGl bool `json:"term:disablewebgl,omitempty"`
|
||||||
TermLocalShellPath string `json:"term:localshellpath,omitempty"`
|
TermLocalShellPath string `json:"term:localshellpath,omitempty"`
|
||||||
|
TermLocalShellOpts []string `json:"term:localshellopts,omitempty"`
|
||||||
|
|
||||||
EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"`
|
EditorMinimapEnabled bool `json:"editor:minimapenabled,omitempty"`
|
||||||
EditorStickyScrollEnabled bool `json:"editor:stickyscrollenabled,omitempty"`
|
EditorStickyScrollEnabled bool `json:"editor:stickyscrollenabled,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user