(cmd *cobra.Command, args []string)
| 53 | } |
| 54 | |
| 55 | func webGetRun(cmd *cobra.Command, args []string) error { |
| 56 | fullORef, err := resolveBlockArg() |
| 57 | if err != nil { |
| 58 | return fmt.Errorf("resolving blockid: %w", err) |
| 59 | } |
| 60 | blockInfo, err := wshclient.BlockInfoCommand(RpcClient, fullORef.OID, nil) |
| 61 | if err != nil { |
| 62 | return fmt.Errorf("getting block info: %w", err) |
| 63 | } |
| 64 | if blockInfo.Block.Meta.GetString(waveobj.MetaKey_View, "") != "web" { |
| 65 | return fmt.Errorf("block %s is not a web block", fullORef.OID) |
| 66 | } |
| 67 | data := wshrpc.CommandWebSelectorData{ |
| 68 | WorkspaceId: blockInfo.WorkspaceId, |
| 69 | BlockId: fullORef.OID, |
| 70 | TabId: blockInfo.TabId, |
| 71 | Selector: args[0], |
| 72 | Opts: &wshrpc.WebSelectorOpts{ |
| 73 | Inner: webGetInner, |
| 74 | All: webGetAll, |
| 75 | }, |
| 76 | } |
| 77 | output, err := wshclient.WebSelectorCommand(RpcClient, data, &wshrpc.RpcOpts{ |
| 78 | Route: wshutil.ElectronRoute, |
| 79 | Timeout: 5000, |
| 80 | }) |
| 81 | if err != nil { |
| 82 | return err |
| 83 | } |
| 84 | if webGetJson { |
| 85 | barr, err := json.MarshalIndent(output, "", " ") |
| 86 | if err != nil { |
| 87 | return fmt.Errorf("json encoding: %w", err) |
| 88 | } |
| 89 | WriteStdout("%s\n", string(barr)) |
| 90 | } else { |
| 91 | for _, item := range output { |
| 92 | WriteStdout("%s\n", item) |
| 93 | } |
| 94 | } |
| 95 | return nil |
| 96 | } |
| 97 | |
| 98 | func webOpenRun(cmd *cobra.Command, args []string) (rtnErr error) { |
| 99 | defer func() { |
nothing calls this directly
no test coverage detected