~ianmjones/snippetpixie

bdbfe62ac84f9341eaf6b4f4feb006d13fe861a0 — Ian M. Jones 8 months ago d205e9b pre-gui
Revert "Add skeleton AutoExpander."

This reverts commit 3f5f96798282f155a30bf393627c84887eeabbe4.
2 files changed, 0 insertions(+), 39 deletions(-)

D cmd/daemon/autoexpander.go
M cmd/daemon/main.go
D cmd/daemon/autoexpander.go => cmd/daemon/autoexpander.go +0 -30
@@ 1,30 0,0 @@
package main

import (
	"errors"
	"git.sr.ht/~ianmjones/snippetpixie/internal/manager"
)

type AutoExpander struct {
	conf    *config
	manager *manager.Manager
}

// NewAutoExpander initialises and returns a Snippet AutoExpander.
func NewAutoExpander(c *config, manager *manager.Manager) (*AutoExpander, error) {
	if manager == nil {
		return nil, errors.New("nil passed as manager")
	}

	autoExpander := &AutoExpander{
		conf:    c,
		manager: manager,
	}

	return autoExpander, nil
}

// Close de-registers all listeners and cleans up.
func (ae *AutoExpander) Close() error {
	return nil
}

M cmd/daemon/main.go => cmd/daemon/main.go +0 -9
@@ 117,15 117,6 @@ func run(ctx context.Context, c *config, out io.Writer) error {
	// Get snippet manager and store in service.
	serv.snippets, err = manager.New(serv.db)

	// Start auto expand service.
	autoExpander, err := NewAutoExpander(c, serv.snippets)
	if err != nil {
		return err
	}
	defer func(autoExpander *AutoExpander) {
		_ = autoExpander.Close()
	}(autoExpander)

	for {
		select {
		case <-ctx.Done():