A9u / urja

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

urja

A general purpose Go wrapper over Mac's pmset command

Installation

go get github.com/A9u/urja

Usage

    // 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())

Functions available

  • GetBatteryStatus() returns string and error and is a wrapper for pmset -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 for man pmset

Contributing

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!

License

Copyright (c) 2021 Anusha Bhat Licensed under the MIT license.

About

License:MIT License


Languages

Language:HTML 54.0%Language:Go 46.0%