MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / tabIndicatorRun

Function tabIndicatorRun

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

Source from the content-addressed store, hash-verified

42}
43
44func tabIndicatorRun(cmd *cobra.Command, args []string) (rtnErr error) {
45 defer func() {
46 sendActivity("tabindicator", rtnErr == nil)
47 }()
48
49 fmt.Fprintf(os.Stderr, "tabindicator is deprecated, use 'wsh badge' instead\n")
50
51 tabId := tabIndicatorTabId
52 if tabId == "" {
53 tabId = os.Getenv("WAVETERM_TABID")
54 }
55 if tabId == "" {
56 return fmt.Errorf("no tab id specified (use --tabid or set WAVETERM_TABID)")
57 }
58
59 oref := waveobj.MakeORef(waveobj.OType_Tab, tabId)
60
61 var eventData baseds.BadgeEvent
62 eventData.ORef = oref.String()
63
64 if tabIndicatorClear {
65 eventData.Clear = true
66 } else {
67 icon := "bell"
68 if len(args) > 0 {
69 icon = args[0]
70 }
71 badgeId, err := uuid.NewV7()
72 if err != nil {
73 return fmt.Errorf("generating badge id: %v", err)
74 }
75 eventData.Badge = &baseds.Badge{
76 BadgeId: badgeId.String(),
77 Icon: icon,
78 Color: tabIndicatorColor,
79 Priority: tabIndicatorPriority,
80 }
81 }
82
83 event := wps.WaveEvent{
84 Event: wps.Event_Badge,
85 Scopes: []string{oref.String()},
86 Data: eventData,
87 }
88
89 err := wshclient.EventPublishCommand(RpcClient, event, &wshrpc.RpcOpts{NoResponse: true})
90 if err != nil {
91 return fmt.Errorf("publishing badge event: %v", err)
92 }
93
94 if tabIndicatorBeep {
95 err = wshclient.ElectronSystemBellCommand(RpcClient, &wshrpc.RpcOpts{Route: "electron"})
96 if err != nil {
97 return fmt.Errorf("playing system bell: %v", err)
98 }
99 }
100
101 if tabIndicatorClear {

Callers

nothing calls this directly

Calls 5

MakeORefFunction · 0.92
EventPublishCommandFunction · 0.92
sendActivityFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected