(cmd *cobra.Command, args []string)
| 29 | } |
| 30 | |
| 31 | func 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 | } |
nothing calls this directly
no test coverage detected