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

Function getCustomInitScriptValue

pkg/blockcontroller/shellcontroller.go:850–880  ·  view source on GitHub ↗

returns (value, metakey)

(meta waveobj.MetaMapType, connName string, shellType string)

Source from the content-addressed store, hash-verified

848
849// returns (value, metakey)
850func getCustomInitScriptValue(meta waveobj.MetaMapType, connName string, shellType string) (string, string) {
851 keys := getCustomInitScriptKeyCascade(shellType)
852 connMeta := meta.GetConnectionOverride(connName)
853 if connMeta != nil {
854 for _, key := range keys {
855 if connMeta.HasKey(key) {
856 return connMeta.GetString(key, ""), "blockmeta/[" + connName + "]/" + key
857 }
858 }
859 }
860 for _, key := range keys {
861 if meta.HasKey(key) {
862 return meta.GetString(key, ""), "blockmeta/" + key
863 }
864 }
865 fullConfig := wconfig.GetWatcher().GetFullConfig()
866 connKeywords := fullConfig.Connections[connName]
867 connKeywordsMap := make(map[string]any)
868 err := utilfn.ReUnmarshal(&connKeywordsMap, connKeywords)
869 if err != nil {
870 log.Printf("error re-unmarshalling connKeywords: %v\n", err)
871 return "", ""
872 }
873 ckMeta := waveobj.MetaMapType(connKeywordsMap)
874 for _, key := range keys {
875 if ckMeta.HasKey(key) {
876 return ckMeta.GetString(key, ""), "connections.json/" + connName + "/" + key
877 }
878 }
879 return "", ""
880}
881
882func updateTermSize(shellProc *shellexec.ShellProc, blockId string, termSize waveobj.TermSize) {
883 err := setTermSizeInDB(blockId, termSize)

Callers 1

getCustomInitScriptFunction · 0.85

Calls 8

GetWatcherFunction · 0.92
ReUnmarshalFunction · 0.92
MetaMapTypeTypeAlias · 0.92
GetConnectionOverrideMethod · 0.80
HasKeyMethod · 0.80
GetStringMethod · 0.80
GetFullConfigMethod · 0.80

Tested by

no test coverage detected