lumecmd

package
v0.0.0-...-dd1ea7c Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitSuccess = iota
	ExitFailure
)
View Source
const Tabstop int = 2

Variables

View Source
var BuildDate string
View Source
var (
	DefaultConfig = Config{
		// contains filtered or unexported fields
	}
)
View Source
var GitCommit string
View Source
var Version string

Functions

func BreatheCmd

func BreatheCmd(ctx Context) (int, error)

func ColorizeIndicator

func ColorizeIndicator(s string) string

func ColorizePower

func ColorizePower(s string) string

func ColorizeStatus

func ColorizeStatus(s lifx.Status) string

func Debugf

func Debugf(format string, a ...interface{})

func ExitWithCode

func ExitWithCode(code int, err error)

func FprintfWithIndent

func FprintfWithIndent(w io.Writer, indent int, format string, a ...interface{}) (n int, err error)

func HelpCmd

func HelpCmd(ctx Context) (int, error)

func LsCmd

func LsCmd(ctx Context) (int, error)

func Main

func Main(args []string) (int, error)

func PoweroffCmd

func PoweroffCmd(ctx Context) (int, error)

func PoweronCmd

func PoweronCmd(ctx Context) (int, error)

func PrintWithIndent

func PrintWithIndent(indent int, s string)

func PrintfWithIndent

func PrintfWithIndent(indent int, format string, a ...interface{}) (n int, err error)

func RegisterCommand

func RegisterCommand(cmd Command) error

func SetColorCmd

func SetColorCmd(ctx Context) (int, error)

func SetStateCmd

func SetStateCmd(ctx Context) (int, error)

func SetWhiteCmd

func SetWhiteCmd(ctx Context) (int, error)

func ShowCmd

func ShowCmd(ctx Context) (int, error)

func ToggleCmd

func ToggleCmd(ctx Context) (int, error)

func ValidateCmd

func ValidateCmd(ctx Context) (int, error)

func VersionCmd

func VersionCmd(ctx Context) (int, error)

func YesNo

func YesNo(v bool) string

Types

type Command

type Command struct {
	Name  string
	Func  func(Context) (int, error)
	Flags *flag.FlagSet
	Use   string
	Short string
	Long  string
}

func GetCommand

func GetCommand(name string) (Command, bool)

func NewCmdBreathe

func NewCmdBreathe() Command

func NewCmdHelp

func NewCmdHelp() Command

func NewCmdLs

func NewCmdLs() Command

func NewCmdPoweroff

func NewCmdPoweroff() Command

func NewCmdPoweron

func NewCmdPoweron() Command

func NewCmdSetColor

func NewCmdSetColor() Command

func NewCmdSetState

func NewCmdSetState() Command

func NewCmdSetWhite

func NewCmdSetWhite() Command

func NewCmdShow

func NewCmdShow() Command

func NewCmdToggle

func NewCmdToggle() Command

func NewCmdValidate

func NewCmdValidate() Command

func NewCmdVersion

func NewCmdVersion() Command

type Config

type Config struct {
	AccessToken  string               `toml:"access_token"`
	OutputFormat string               `toml:"output_format"`
	Colors       map[string][]float32 `toml:"colors"`

	Debug     bool   `toml:"debug"`
	Indicator string `toml:"indicator"`
	// contains filtered or unexported fields
}

func GetConfig

func GetConfig() *Config

func LoadConfig

func LoadConfig(s string) (*Config, error)

func LoadConfigFile

func LoadConfigFile(configPath string) (*Config, error)

func NewConfig

func NewConfig() *Config

func (*Config) MergeWithEnv

func (c *Config) MergeWithEnv()

func (*Config) Validate

func (c *Config) Validate() error

Validate configuration struct

type Context

type Context struct {
	Flags  Flags
	Args   []string
	Client *lifx.Client
	Config Config
	Name   string
}

type Flags

type Flags struct {
	*flag.FlagSet
}

func (Flags) Bool

func (f Flags) Bool(name string) bool

func (Flags) Float32

func (f Flags) Float32(name string) float32

func (Flags) Float64

func (f Flags) Float64(name string) float64

func (Flags) Int16

func (f Flags) Int16(name string) int16

func (Flags) String

func (f Flags) String(name string) string

type Printer

type Printer interface {
	Results(results []lifx.Result) string
	Lights(lights []lifx.Light) string
}

func NewPrinter

func NewPrinter(format string) Printer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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