cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAllFlags

func AddAllFlags(c *cobra.Command)

AddAllFlags will add all the flags provided in this package to the provided command and will bind those flags with viper.

func AddBotFlags

func AddBotFlags(c *cobra.Command)

func AddConfigurationFlag

func AddConfigurationFlag(c *cobra.Command)

AddConfigurationFlag adds support to provide a configuration file on the command line.

func AddDatabaseFlags

func AddDatabaseFlags(c *cobra.Command)

func AddLoggerFlags

func AddLoggerFlags(c *cobra.Command)

AddLoggerFlags adds support to configure the level of the logger.

func NewLogger

func NewLogger(c *Conf) zerolog.Logger

NewLogger will return a new logger

Types

type BotConf

type BotConf struct {
	Token  string `mapstructure:"token"`
	Prefix string `mapstructure:"prefix"`
}

type Conf

type Conf struct {
	Port     int          `mapstructure:"port"`
	Log      LogConf      `mapstructure:"log"`
	Bot      BotConf      `mapstructure:"bot"`
	Database DatabaseConf `mapstructure:"database"`
}

func NewConf

func NewConf() (*Conf, error)

NewConf will parse and return the configuration

type DatabaseConf

type DatabaseConf struct {
	Path string `mapstructure:"path"`
}

type LogConf

type LogConf struct {
	Level  string `mapstructure:"level"`
	Type   string `mapstructure:"type"`
	Caller bool   `mapstructure:"caller"`
}

Jump to

Keyboard shortcuts

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