cli

package
v0.0.0-...-fb49ba0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cli consolidates flag and main function handling.

Index

Constants

This section is empty.

Variables

View Source
var Default = Common{}

Default contains the default flags. Make a copy of this, do not reuse.

Functions

func Run

func Run(cmd Command, args []string)

Run parses the argument and runs the given command. If the ENV_FILE environment variable is set, the files listed in it will be loaded before parsing, to allow for a simple layered configuration setup.

Types

type Command

type Command interface {
	Name() string
	Main(ctx context.Context, args []string)
	IsDebug() bool
	RunDefaultServeMux()
}

Command is a single command that can be parsed and run.

type Common

type Common struct {
	Debug               bool   `long:"debug" env:"HB_DEBUG" description:"Enables debug mode and the debug log level"`
	DefaultServeMuxAddr string `` /* 149-byte string literal not displayed */
}

Common contains flags common to all commands.

func (*Common) IsDebug

func (c *Common) IsDebug() bool

IsDebug returns true if the command should be run in debug mode.

func (*Common) RunDefaultServeMux

func (c *Common) RunDefaultServeMux()

RunDefaultServeMux runs the global default HTTP mux in the background, if the addr has been set.

Directories

Path Synopsis
flags
botflags
Package botflags processes bot-related flags.
Package botflags processes bot-related flags.
httpflags
Package httpflags provides HTTP client flags.
Package httpflags provides HTTP client flags.
ircflags
Package ircflags processes IRC-related flags.
Package ircflags processes IRC-related flags.
jaegerflags
Package jaegerflags processes Jaeger-related flags.
Package jaegerflags processes Jaeger-related flags.
nsqflags
Package nsqflags processes NSQ-related flags.
Package nsqflags processes NSQ-related flags.
promflags
Package promflags provides prometheus metric flags.
Package promflags provides prometheus metric flags.
redisflags
Package redisflags processes redis-related flags.
Package redisflags processes redis-related flags.
sqlflags
Package sqlflags processes SQL database related flags.
Package sqlflags processes SQL database related flags.
twitchflags
Package twitchflags processes Twitch client related flags.
Package twitchflags processes Twitch client related flags.
webflags
Package webflags proceses web server related flags.
Package webflags proceses web server related flags.
subcommands
bot
Package bot implements the main command for the bot service.
Package bot implements the main command for the bot service.
confconvert
Package confconvert implements the main command for the CoeBot config converter.
Package confconvert implements the main command for the CoeBot config converter.
confimport
Package confimport implements the main command for the config dump importer.
Package confimport implements the main command for the config dump importer.
irc
Package irc implements the main command for the IRC service.
Package irc implements the main command for the IRC service.
sitedbconvert
Package sitedbconvert implements the main command for the site-db dump converter.
Package sitedbconvert implements the main command for the site-db dump converter.
web
Package web implements the main command for the web service.
Package web implements the main command for the web service.

Jump to

Keyboard shortcuts

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