-
Notifications
You must be signed in to change notification settings - Fork 3
/
bitbar_test.go
35 lines (33 loc) · 1.04 KB
/
bitbar_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package bitbar
// Example Bitbar plugin resulting in the following output:
// MenuItem 1 | color=red href=http://localhost:8080 dropdown=false
// MenuItem 2 | dropdown=false
// ---
// DropDown Level 1 A | color=red font=UbuntuMono-Bold size=12
// -- DropDown Level 2 A
// -- DropDown Level 1 B | bash="/path/to/cmd" param1=arg1 param2=arg2
// ---- DropDown Level 3 A
// DropDown Level 1 B | color=red font=UbuntuMono-Bold size=12
func Example() {
b := New()
s := Style{
Font: "UbuntuMono-Bold",
Color: "red",
Size: 12,
}
c := Cmd{
Bash: "/path/to/cmd",
Params: []string{"arg1", "arg2"},
}
b.StatusLine("MenuItem 1").Href("http://localhost:8080").Color("red").DropDown(false)
b.StatusLine("MenuItem 2").DropDown(false)
menu := b.NewSubMenu()
menu.Line("DropDown Level 1 A").Style(s)
submenu := b.SubMenu.NewSubMenu()
submenu.Line("DropDown Level 2 A")
submenu.Line("DropDown Level 1 B").Command(c)
subsubmenu := submenu.NewSubMenu()
subsubmenu.Line("DropDown Level 3 A")
menu.Line("DropDown Level 1 B").Style(s)
b.Render()
}