A general purpose Go wrapper over Mac's pmset command
go get github.com/A9u/urja
// returns status of batteries and UPSs.
output, err := urja.GetBatteryStatus()
// run custom command, i.e, pass args to pmset
output, err := urja.RunCustomCommand("-g", "therm")
fmt.Println(output.String())
// run man command on pmset
output, err := urja.GetHelp()
fmt.Println(output.String())
GetBatteryStatus()
returns string and error and is a wrapper forpmset -g ps
RunCustomCommand(args ...string)
returns bytes.Buffer and error. Variable number of arguments can be passed.GetHelp()
returns bytes.Buffer and error. It is a wrapper forman pmset
Feature requests are always welcome with accompanying PR(if possible 😉). Please file an issue if you are facing any challenges. Labels used are bug/question/enhancement
If there's anything you'd like to chat about, please feel free to reach me via twitter!
Copyright (c) 2021 Anusha Bhat Licensed under the MIT license.