Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultSearchProvider = "https://duckduckgo.com/%s"
)
Variables ¶
View Source
var ( ErrUnrecognizedCommand = errors.New("unrecognized command") ErrNotEnoughArguments = errors.New("not enough arguments") )
Functions ¶
func NewServer ¶
func NewServer(tp TemplateRenderer, shortcutStore *ShortcutStore, accessLogging bool) http.Handler
Types ¶
type CommandHandler ¶
type ShortcutData ¶ added in v0.2.1
type ShortcutData struct {
Shortcuts Shortcuts `json:"shortcuts"`
}
type ShortcutStore ¶ added in v0.2.1
type ShortcutStore struct {
Path string
}
func (*ShortcutStore) Init ¶ added in v0.2.1
func (ss *ShortcutStore) Init() error
func (*ShortcutStore) LoadShortcuts ¶ added in v0.2.1
func (ss *ShortcutStore) LoadShortcuts(copyTo io.Writer) (Shortcuts, error)
func (*ShortcutStore) SaveShortcuts ¶ added in v0.2.1
func (ss *ShortcutStore) SaveShortcuts(shorts Shortcuts, copyTo io.Writer) error
type Shortcuts ¶ added in v0.2.1
func NewDefaultShortcuts ¶ added in v0.2.1
func NewDefaultShortcuts() Shortcuts
type TemplateRenderer ¶
type TemplateRenderer struct {
FS http.FileSystem
}
func (TemplateRenderer) Render ¶
func (tr TemplateRenderer) Render(name string, templVars TemplateVariables, w io.Writer) error
func (TemplateRenderer) RenderHandler ¶
func (tr TemplateRenderer) RenderHandler(filename string, ss *CommandHandler, headers http.Header) http.HandlerFunc
type TemplateVariables ¶
func ToTemplateVars ¶
func ToTemplateVars(req *http.Request, shortcuts map[string]string) TemplateVariables
Click to show internal directories.
Click to hide internal directories.