This commit is contained in:
parent
1d0d3230c9
commit
f96b8a8266
9 changed files with 154 additions and 7 deletions
13
app.go
13
app.go
|
|
@ -15,13 +15,14 @@ import (
|
|||
|
||||
// App struct
|
||||
type App struct {
|
||||
store *Store
|
||||
uclInst *ucl.Inst
|
||||
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// NewApp creates a new App application struct
|
||||
func NewApp() *App {
|
||||
func NewApp(store *Store) *App {
|
||||
uclInst := ucl.New(
|
||||
ucl.WithModule(builtins.CSV(nil)),
|
||||
ucl.WithModule(builtins.Fns()),
|
||||
|
|
@ -34,6 +35,7 @@ func NewApp() *App {
|
|||
ucl.WithModule(builtins.Time()),
|
||||
)
|
||||
return &App{
|
||||
store: store,
|
||||
uclInst: uclInst,
|
||||
}
|
||||
}
|
||||
|
|
@ -44,6 +46,15 @@ func (a *App) startup(ctx context.Context) {
|
|||
a.ctx = context.WithValue(ctx, uclInstKey, a.uclInst)
|
||||
}
|
||||
|
||||
func (a *App) LoadCurrentBuffer() (string, error) {
|
||||
return a.store.LoadBuffer()
|
||||
}
|
||||
|
||||
func (a *App) SaveCurrentBuffer(buffer string) error {
|
||||
log.Printf("Saving buffer")
|
||||
return a.store.SaveBuffer(buffer)
|
||||
}
|
||||
|
||||
func (a *App) ListProcessors() (resp []ListProcessorsResponse) {
|
||||
for k, v := range TextFilters {
|
||||
resp = append(resp, ListProcessorsResponse{Name: k, Label: v.Label})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue