johnmccabe / vmpooler-bitbar

vmpooler status and management in your menubar with bitbar
Other
8 stars 12 forks source link

Work with SwiftBar #19

Closed MikaelSmith closed 10 months ago

MikaelSmith commented 3 years ago

BitBar is largely unmaintained (last release in 2016). https://github.com/swiftbar/SwiftBar is a spiritual successor that's largely compatible with BitBar scripts.

Issues I've encountered

MikaelSmith commented 3 years ago

When I try to run vmpooler-bitbar, which is what I assume BitBar/SwiftBar do, I get

$ vmpooler-bitbar
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/johnmccabe/vmpooler-bitbar/commands.errorMenu(0x14e6b00, 0xc4202ce0d0)
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/commands/menu.go:237 +0x48c
github.com/johnmccabe/vmpooler-bitbar/commands.runMenu(0x1711bc0, 0x1737488, 0x0, 0x0)
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/commands/menu.go:49 +0x4519
github.com/johnmccabe/vmpooler-bitbar/commands.runRoot(0x1711bc0, 0x1737488, 0x0, 0x0)
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/commands/root.go:25 +0xba
github.com/johnmccabe/vmpooler-bitbar/vendor/github.com/spf13/cobra.(*Command).execute(0x1711bc0, 0xc4200101b0, 0x0, 0x0, 0x1711bc0, 0xc4200101b0)
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/vendor/github.com/spf13/cobra/command.go:766 +0x2c1
github.com/johnmccabe/vmpooler-bitbar/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x1711bc0, 0x1005f4c, 0xc4200200b8, 0x0)
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/vendor/github.com/spf13/cobra/command.go:852 +0x30a
github.com/johnmccabe/vmpooler-bitbar/vendor/github.com/spf13/cobra.(*Command).Execute(0x1711bc0, 0x0, 0x13b07f5)
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/vendor/github.com/spf13/cobra/command.go:800 +0x2b
github.com/johnmccabe/vmpooler-bitbar/commands.Execute()
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/commands/root.go:11 +0x2d
main.main()
    /Users/john.mccabe/workspaces/go/src/github.com/johnmccabe/vmpooler-bitbar/main.go:6 +0x20

Ok, this was caused by setting the endpoint to https://abs-prod.k8s.infracore.puppet.net/api/v2.

MikaelSmith commented 3 years ago

Usage appears to happen because SwiftBar runs

$ export OS_APPEARANCE='Light' OS_VERSION_PATCH='7' OS_VERSION_MAJOR='10' SWIFTBAR='1' SWIFTBAR_VERSION='1.2.1' SWIFTBAR_BUILD='237' SWIFTBAR_PLUGINS_PATH='/Users/michaelsmith/Documents/bitbar' SWIFTBAR_PLUGIN_PATH='/usr/local/Cellar/vmpooler-bitbar/v2.1.1/bin/vmpooler-bitbar' OS_VERSION_MINOR='15';/usr/local/Cellar/vmpooler-bitbar/v2.1.1/bin/vmpooler-bitbar
Usage:
  vmpooler-bitbar [flags]
  vmpooler-bitbar [command]

Available Commands:
  config
  help        Help about any command
  install
  token

Flags:
  -h, --help   help for vmpooler-bitbar

Use "vmpooler-bitbar [command] --help" for more information about a command.

So https://github.com/johnmccabe/vmpooler-bitbar/blob/master/commands/root.go#L23-L25 doesn't work.

MikaelSmith commented 3 years ago

One probably unrelated note: https://github.com/matryer/bitbar says compiled Go plugins need to use an extension and suggests .cgo.

johnmccabe commented 3 years ago

@matryer has released xbar which should be compatible out of the box, worth checking out:

johnmccabe commented 10 months ago

Closing as stale