utils

package
v0.0.0-...-dafb618 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultiError

func MultiError(errs []error) error

MultiError will convert a slice of errors into a single error

func NewLogWriter

func NewLogWriter(debug bool) io.Writer

NewLogWriter will return an io.Writer that writes to stdout. If debug is false, messages that begin with [DEBUG] will not be written

func ParseShell

func ParseShell(input string) ([]string, error)

ParseShell takes a string input and parses it into a []string of arguments. Anything wrapped in quotation marks will be treated as a single argument. If there is an odd number of quotation marks, an error will be returned.

Types

type SlackClient

type SlackClient interface {
	DeleteMessage(channel, messageTimestamp string) (string, string, error)
	GetGroupHistory(group string, params slack.HistoryParameters) (*slack.History, error)
	GetChannelHistory(channelID string, params slack.HistoryParameters) (*slack.History, error)
	GetIMHistory(channel string, params slack.HistoryParameters) (*slack.History, error)
	SendMessage(channel string, options ...slack.MsgOption) (string, string, string, error)
}

SlackClient is used to mock the nlopes/slack client

type WriterFunc

type WriterFunc func(p []byte) (n int, err error)

WriterFunc is a function which satisfies the io.Writer interface

func (WriterFunc) Write

func (w WriterFunc) Write(p []byte) (n int, err error)

Write will execute the WriterFunc

Jump to

Keyboard shortcuts

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