checkpoint
parent
c885495ef4
commit
0cb291326a
|
|
@ -105,7 +105,8 @@ func (a Aliases) Define(gvr string, aliases ...string) {
|
||||||
func (a Aliases) LoadAliases(path string) error {
|
func (a Aliases) LoadAliases(path string) error {
|
||||||
f, err := ioutil.ReadFile(path)
|
f, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.Warn().Err(err).Msgf("No custom aliases found")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var aa Aliases
|
var aa Aliases
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import (
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const refreshRate = 1 * time.Second
|
||||||
|
|
||||||
type TableListener interface {
|
type TableListener interface {
|
||||||
TableDataChanged(render.TableData)
|
TableDataChanged(render.TableData)
|
||||||
TableLoadFailed(error)
|
TableLoadFailed(error)
|
||||||
|
|
@ -87,7 +89,7 @@ func (t *Table) updater(ctx context.Context) {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
case <-time.After(t.refreshRate):
|
case <-time.After(refreshRate):
|
||||||
t.refresh(ctx)
|
t.refresh(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ func newCommand(app *App) *command {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *command) Init() error {
|
func (c *command) Init() error {
|
||||||
log.Debug().Msgf("COMMAND INIT")
|
|
||||||
c.alias = dao.NewAlias(c.app.factory)
|
c.alias = dao.NewAlias(c.app.factory)
|
||||||
if _, err := c.alias.Ensure(); err != nil {
|
if _, err := c.alias.Ensure(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue