Skip to content

Commit

Permalink
Switch command line handling
Browse files Browse the repository at this point in the history
  • Loading branch information
venkytv committed Apr 26, 2023
1 parent e52561d commit 754b4b0
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 300 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
teabot
dist/
8 changes: 4 additions & 4 deletions conversation/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/duh-uh/teabot/globals"
"github.com/duh-uh/teabot/message"
"github.com/sirupsen/logrus"
"github.com/venkytv/go-config"
"github.com/urfave/cli/v2"
)

type Manager struct {
Expand All @@ -27,7 +27,7 @@ type Manager struct {
channelConvLock *sync.RWMutex
}

func NewManager(ctx context.Context, cfg *config.Config, backend backend.Backender, backendQueues backend.BackendQueues) *Manager {
func NewManager(ctx context.Context, cfg *cli.Context, backend backend.Backender, backendQueues backend.BackendQueues) *Manager {
engineRegistry := engine.NewEngineRegistry()

engineRegistry.Register("executable", engine.ExecEngineFactoryLoader{})
Expand All @@ -50,8 +50,8 @@ func NewManager(ctx context.Context, cfg *config.Config, backend backend.Backend
}

// Load engines from the config directory
func (cm *Manager) LoadEngines(ctx context.Context, cfg *config.Config) {
config_dir := cfg.GetString("config-directory")
func (cm *Manager) LoadEngines(ctx context.Context, cfg *cli.Context) {
config_dir := cfg.String("config-directory")

config_files, err := filepath.Glob(filepath.Join(config_dir, "*.yaml"))
if err != nil {
Expand Down
17 changes: 4 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,30 @@ require (
github.com/sirupsen/logrus v1.8.1
github.com/slack-go/slack v0.10.2
github.com/stretchr/testify v1.8.2
github.com/venkytv/go-config v0.2.0
github.com/urfave/cli/v2 v2.25.1
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/leodido/go-urn v1.2.2 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 754b4b0

Please sign in to comment.