general

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const BuildName = "v1.1.1"

BuildName is the name of the build

View Source
const BuildNo = 3

BuildNo is the build number

View Source
const Description = "Lux is a cli for controlling and monitoring Govee lighting strips"

Description is the description

View Source
const GHRepo = "https://github.com/bandev/lux"

GHRepo is the repo url

View Source
const License = "GPL-3.0"

License is the license

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(b bool) string

BoolToString converts a Boolean to a string. Makes boolean values more readable to a user. When true outputs Yes.

func GetBits added in v1.1.0

func GetBits() string

GetBits returns x64 or x86 depending on the installed version

func GridSpacing

func GridSpacing(s1 string) string

GridSpacing calculates & prints spaces in order to make grid style print statements.

func HexTo2Places

func HexTo2Places(h string) string

HexTo2Places is used for converting the value 0 to 00. This is used for hexadecimal colour codes.

func Line

func Line()

Line prints an empty line to the screen

func PrintBoolParagraph

func PrintBoolParagraph(s1 string, c1 color.Attribute, yes bool)

PrintBoolParagraph is very specific function for printing in a format like X: [ YES / NO ]

func PrintError

func PrintError(s string)

PrintError prints an error message to the string

func PrintHeading

func PrintHeading(s string, c color.Attribute)

PrintHeading prints text in a unified heading format.

func PrintNeutral

func PrintNeutral(s string)

PrintNeutral prints a neutral message to the screen

func PrintStringParagraph

func PrintStringParagraph(s1 string, s2 string, c1 color.Attribute)

PrintStringParagraph prints text in a unified paragraph format taking into account grid spacing.

func PrintWarning

func PrintWarning(s string)

PrintWarning prints a warning message to the screen

func StringToBool

func StringToBool(s string) bool

StringToBool converts a string to a boolean. Sorta like the reverse of BoolToString. It will convert words like on / off, true / false into boolean data. Anything else will return false.

Types

type Colour

type Colour struct {
	R int64
	G int64
	B int64
}

Colour defines the colour values used for interfacing with Govee's api.

func (*Colour) ToString

func (c *Colour) ToString() string

ToString converts a Colour struct into a hexadecimal colour code.

type Connection

type Connection struct {
	Key  string
	Base string
	// contains filtered or unexported fields
}

Connection contains information about the connection to the Govee API such as the user's API Key & the server URL.

func (Connection) Get

func (c Connection) Get(path string) []byte

Get makes a GET request to the API server with the path provided as a string. Usually a JSON object is returned in byte array form to help with parsing.

func (Connection) Put

func (c Connection) Put(path string, body []byte) []byte

Put uses the PUT request to send data to the API.

func (Connection) TestKey

func (c Connection) TestKey() bool

TestKey uses the devices endpoint to verify that the API Key provided is valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL