cmd

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFlagHelpTemplate = `` /* 132-byte string literal not displayed */
View Source
const DefaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}

{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
View Source
const DefaultUsageTemplate = `` /* 771-byte string literal not displayed */
View Source
const DefaultVersionTemplate = `
{{with .Name}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}}
`
View Source
const (
	EnvPrefix = "X32"
)
View Source
const ExtendedHelpText = `` /* 1738-byte string literal not displayed */

Variables

This section is empty.

Functions

func AddJsonSuffix

func AddJsonSuffix(fn string) string

func AttachCmdConfig

func AttachCmdConfig(cmd *cobra.Command) *cobra.Command

func AttachCmdCron

func AttachCmdCron(cmd *cobra.Command) *cobra.Command

func AttachCmdData

func AttachCmdData(cmd *cobra.Command) *cobra.Command

func AttachCmdHelpFlags

func AttachCmdHelpFlags(cmd *cobra.Command) *cobra.Command

func AttachCmdMqtt

func AttachCmdMqtt(cmd *cobra.Command) *cobra.Command

func AttachCmdVersion

func AttachCmdVersion(cmd *cobra.Command) *cobra.Command

func AttachCmdX32

func AttachCmdX32(cmd *cobra.Command) *cobra.Command

func AttachRootCmd

func AttachRootCmd(cmd *cobra.Command) *cobra.Command

func BuildCmd

func BuildCmd(cmd *cobra.Command) string

func Execute

func Execute() error

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ExtendedHelp

func ExtendedHelp()

func LogPrint

func LogPrint(format string, args ...interface{})

func LogPrintDate

func LogPrintDate(format string, args ...interface{})

func MqttMessageHandler

func MqttMessageHandler(_ mqtt.Client, message mqtt.Message)

func PrintConfig

func PrintConfig(cmd *cobra.Command)

func PrintExamples

func PrintExamples(cmd *cobra.Command, examples ...string) string

func PrintFlagEnv

func PrintFlagEnv(flag string) string

func PrintFlags

func PrintFlags(cmd *cobra.Command)

func ReExecute

func ReExecute() error

func ResetArgs

func ResetArgs(args ...string)

func SwitchOutput

func SwitchOutput(cmd *cobra.Command) error

func TimeNow

func TimeNow() string

func X32MessageHandler

func X32MessageHandler(msg *Behringer.Message)

Types

type CommandArgs

type CommandArgs struct {
	X32 *Behringer.X32
	// Git *mmGit.Git
	Mqtt *mmHa.Mqtt

	ConfigDir   string
	CacheDir    string
	ConfigFile  string
	WriteConfig bool
	Quiet       bool
	Debug       bool
	OutputType  string
	OutputFile  string

	// Behringer api
	X32Timeout    time.Duration
	X32Host       string
	X32Username   string
	X32Password   string
	X32Port       string
	X32OutputType string

	// HASSIO MQTT
	MqttUsername string
	MqttPassword string
	MqttHost     string
	MqttPort     string

	// Google sheets
	GoogleSheet       string
	GoogleSheetUpdate bool

	// GitHub api
	GitRepo     string
	GitRepoDir  string
	GitUsername string
	GitPassword string
	GitKeyFile  string
	GitToken    string
	GitDiffCmd  string

	Args []string

	Valid bool
	Error error
}
var Cmd CommandArgs

func (*CommandArgs) GetInitial

func (ca *CommandArgs) GetInitial()

func (*CommandArgs) GitLs

func (ca *CommandArgs) GitLs(options ...string) error

func (*CommandArgs) GitSave

func (ca *CommandArgs) GitSave(entities ...string) error

func (*CommandArgs) GitSet

func (ca *CommandArgs) GitSet() error

func (*CommandArgs) GitSync

func (ca *CommandArgs) GitSync(msg string, entities ...string) error

func (*CommandArgs) GoogleUpdate

func (ca *CommandArgs) GoogleUpdate(entities ...string) error

func (*CommandArgs) IsValid

func (ca *CommandArgs) IsValid() error

func (*CommandArgs) MqttArgs

func (ca *CommandArgs) MqttArgs(cmd *cobra.Command, args []string) error

func (*CommandArgs) MqttCron

func (ca *CommandArgs) MqttCron() error

func (*CommandArgs) PreRun

func (ca *CommandArgs) PreRun(cmd *cobra.Command, args []string, fn ...PreRunE) error

func (*CommandArgs) ProcessArgs

func (ca *CommandArgs) ProcessArgs(_ *cobra.Command, args []string) error

func (*CommandArgs) PublishAux

func (ca *CommandArgs) PublishAux(id int)

func (*CommandArgs) PublishAuxes

func (ca *CommandArgs) PublishAuxes()

func (*CommandArgs) PublishBus

func (ca *CommandArgs) PublishBus(id int)

func (*CommandArgs) PublishBusses

func (ca *CommandArgs) PublishBusses()

func (*CommandArgs) PublishChannel

func (ca *CommandArgs) PublishChannel(id int)

func (*CommandArgs) PublishChannels

func (ca *CommandArgs) PublishChannels()

func (*CommandArgs) PublishMatrices

func (ca *CommandArgs) PublishMatrices()

func (*CommandArgs) PublishMatrix

func (ca *CommandArgs) PublishMatrix(id int)

func (*CommandArgs) Update1

func (ca *CommandArgs) Update1(newDay bool) error

func (*CommandArgs) X32Args

func (ca *CommandArgs) X32Args(_ *cobra.Command, _ []string) error

type CronStruct

type CronStruct struct {
	Scheduler *gocron.Scheduler
	Job       *gocron.Job
}
var Cron CronStruct

type PreRunE

type PreRunE func(cmd *cobra.Command, args []string) error

Jump to

Keyboard shortcuts

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