MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / getLocalShellPath

Function getLocalShellPath

pkg/blockcontroller/shellcontroller.go:675–703  ·  view source on GitHub ↗
(blockMeta waveobj.MetaMapType)

Source from the content-addressed store, hash-verified

673}
674
675func getLocalShellPath(blockMeta waveobj.MetaMapType) (string, error) {
676 shellPath := blockMeta.GetString(waveobj.MetaKey_TermLocalShellPath, "")
677 if shellPath != "" {
678 return shellPath, nil
679 }
680
681 connName := blockMeta.GetString(waveobj.MetaKey_Connection, "")
682 if strings.HasPrefix(connName, "local:") {
683 variant := strings.TrimPrefix(connName, "local:")
684 if variant == LocalConnVariant_GitBash {
685 if runtime.GOOS != "windows" {
686 return "", fmt.Errorf("connection \"local:gitbash\" is only supported on Windows")
687 }
688 fullConfig := wconfig.GetWatcher().GetFullConfig()
689 gitBashPath := shellutil.FindGitBash(&fullConfig, false)
690 if gitBashPath == "" {
691 return "", fmt.Errorf("connection \"local:gitbash\": git bash not found on this system, please install Git for Windows or set term:localshellpath to specify the git bash location")
692 }
693 return gitBashPath, nil
694 }
695 return "", fmt.Errorf("unsupported local connection type: %q", connName)
696 }
697
698 settings := wconfig.GetWatcher().GetFullConfig().Settings
699 if settings.TermLocalShellPath != "" {
700 return settings.TermLocalShellPath, nil
701 }
702 return shellutil.DetectLocalShellPath(), nil
703}
704
705func getLocalShellOpts(blockMeta waveobj.MetaMapType) []string {
706 if blockMeta.HasKey(waveobj.MetaKey_TermLocalShellOpts) {

Callers 1

Calls 5

GetWatcherFunction · 0.92
FindGitBashFunction · 0.92
DetectLocalShellPathFunction · 0.92
GetStringMethod · 0.80
GetFullConfigMethod · 0.80

Tested by

no test coverage detected