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

Function editConfigRun

cmd/wsh/cmd/wshcmd-editconfig.go:31–63  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

29}
30
31func editConfigRun(cmd *cobra.Command, args []string) (rtnErr error) {
32 defer func() {
33 sendActivity("editconfig", rtnErr == nil)
34 }()
35
36 configFile := "settings.json" // default
37 if len(args) > 0 {
38 configFile = args[0]
39 }
40
41 tabId := getTabIdFromEnv()
42 if tabId == "" {
43 return fmt.Errorf("no WAVETERM_TABID env var set")
44 }
45
46 wshCmd := &wshrpc.CommandCreateBlockData{
47 TabId: tabId,
48 BlockDef: &waveobj.BlockDef{
49 Meta: map[string]interface{}{
50 waveobj.MetaKey_View: "waveconfig",
51 waveobj.MetaKey_File: configFile,
52 },
53 },
54 Magnified: editConfigMagnified,
55 Focused: true,
56 }
57
58 _, err := wshclient.CreateBlockCommand(RpcClient, *wshCmd, &wshrpc.RpcOpts{Timeout: 2000})
59 if err != nil {
60 return fmt.Errorf("opening config file: %w", err)
61 }
62 return nil
63}

Callers

nothing calls this directly

Calls 3

CreateBlockCommandFunction · 0.92
sendActivityFunction · 0.85
getTabIdFromEnvFunction · 0.85

Tested by

no test coverage detected