config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Id    string
	Help  string
	Items []*Item
}

Argument is the command argument

type Auth

type Auth struct {
	Type           string
	Username       string
	Password       string
	PrivateKeyPath string
	Passphrase     string
}

Auth is the authentication information

type Command

type Command struct {
	Id                   string
	Help                 string
	Format               string
	Arguments            []*Argument
	Timeout              time.Duration
	MaxSymbolsPerMessage int
	MaxMessages          int
}

Command is the command attributes and arguments

type Config

type Config struct {
	Settings *Settings
	Hosts    map[string]*Host
	Groups   map[string]*Group
	Help     string
}

Config is the main config type

func Parse

func Parse(configData string) (*Config, error)

Parse reads the config text and returns the parsed config. A successful call returns err == nil.

func ParseFile

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

ParseFile reads the file named by filename and returns the parsed config. A successful call returns err == nil.

type Group

type Group struct {
	Id       string
	Help     string
	Hosts    map[string]*Host
	Commands map[string]*Command
}

Group is the group with commands

type Host

type Host struct {
	Id      string
	Address string
	Port    int
	Auth    *Auth
}

Host is the host address, port, authentication and etc.

type Item

type Item struct {
	Name  string
	Value string
}

Item is the argument item information

type Settings

type Settings struct {
	Token    string
	Channels map[string]struct{}
	Users    map[string]struct{}
	Admins   map[string]struct{}
}

Settings is the config's part with slack token, users, channels and etc.

Jump to

Keyboard shortcuts

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