(cmd *cobra.Command, args []string)
| 29 | } |
| 30 | |
| 31 | func createBlockRun(cmd *cobra.Command, args []string) error { |
| 32 | viewName := args[0] |
| 33 | var metaSetStrs []string |
| 34 | if len(args) > 1 { |
| 35 | metaSetStrs = args[1:] |
| 36 | } |
| 37 | tabId := getTabIdFromEnv() |
| 38 | if tabId == "" { |
| 39 | return fmt.Errorf("no WAVETERM_TABID env var set") |
| 40 | } |
| 41 | meta, err := parseMetaSets(metaSetStrs) |
| 42 | if err != nil { |
| 43 | return err |
| 44 | } |
| 45 | meta["view"] = viewName |
| 46 | data := wshrpc.CommandCreateBlockData{ |
| 47 | TabId: tabId, |
| 48 | BlockDef: &waveobj.BlockDef{ |
| 49 | Meta: meta, |
| 50 | }, |
| 51 | Magnified: createBlockMagnified, |
| 52 | Focused: true, |
| 53 | } |
| 54 | oref, err := wshclient.CreateBlockCommand(RpcClient, data, nil) |
| 55 | if err != nil { |
| 56 | return fmt.Errorf("create block failed: %v", err) |
| 57 | } |
| 58 | fmt.Printf("created block %s\n", oref.OID) |
| 59 | return nil |
| 60 | } |
nothing calls this directly
no test coverage detected