MCPcopy Create free account
hub / github.com/wavetermdev/waveterm / deleteBlockRun

Function deleteBlockRun

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

Source from the content-addressed store, hash-verified

23}
24
25func deleteBlockRun(cmd *cobra.Command, args []string) (rtnErr error) {
26 defer func() {
27 sendActivity("deleteblock", rtnErr == nil)
28 }()
29 fullORef, err := resolveBlockArg()
30 if err != nil {
31 return err
32 }
33 if fullORef.OType != "block" {
34 return fmt.Errorf("object reference is not a block")
35 }
36 deleteBlockData := &wshrpc.CommandDeleteBlockData{
37 BlockId: fullORef.OID,
38 }
39 err = wshclient.DeleteBlockCommand(RpcClient, *deleteBlockData, &wshrpc.RpcOpts{Timeout: 2000})
40 if err != nil {
41 return fmt.Errorf("delete block failed: %v", err)
42 }
43 WriteStdout("block deleted\n")
44 return nil
45}

Callers

nothing calls this directly

Calls 4

DeleteBlockCommandFunction · 0.92
sendActivityFunction · 0.85
resolveBlockArgFunction · 0.85
WriteStdoutFunction · 0.85

Tested by

no test coverage detected