(id string)
| 184 | } |
| 185 | |
| 186 | func resolveSimpleId(id string) (*waveobj.ORef, error) { |
| 187 | if isFullORef(id) { |
| 188 | orefObj, err := waveobj.ParseORef(id) |
| 189 | if err != nil { |
| 190 | return nil, fmt.Errorf("error parsing full ORef: %v", err) |
| 191 | } |
| 192 | return &orefObj, nil |
| 193 | } |
| 194 | blockId := os.Getenv("WAVETERM_BLOCKID") |
| 195 | if blockId == "" { |
| 196 | return nil, fmt.Errorf("no WAVETERM_BLOCKID env var set") |
| 197 | } |
| 198 | rtnData, err := wshclient.ResolveIdsCommand(RpcClient, wshrpc.CommandResolveIdsData{ |
| 199 | BlockId: blockId, |
| 200 | Ids: []string{id}, |
| 201 | }, &wshrpc.RpcOpts{Timeout: 2000}) |
| 202 | if err != nil { |
| 203 | return nil, fmt.Errorf("error resolving ids: %v", err) |
| 204 | } |
| 205 | oref, ok := rtnData.ResolvedIds[id] |
| 206 | if !ok { |
| 207 | return nil, fmt.Errorf("id not found: %q", id) |
| 208 | } |
| 209 | return &oref, nil |
| 210 | } |
| 211 | |
| 212 | func getTabIdFromEnv() string { |
| 213 | return os.Getenv("WAVETERM_TABID") |
no test coverage detected