mirror of
https://github.com/foomo/posh-providers.git
synced 2025-10-16 12:35:41 +00:00
feat: clear cache
This commit is contained in:
parent
adceff3e4d
commit
2ac4f35ff5
@ -73,7 +73,7 @@ func (c *Command) Validate(ctx context.Context, r *readline.Readline) error {
|
||||
func (c *Command) Execute(ctx context.Context, r *readline.Readline) error {
|
||||
dir, args := r.Args().Shift()
|
||||
if _, err := os.Stat(dir); errors.Is(err, os.ErrNotExist) {
|
||||
c.cache.Delete("")
|
||||
c.cache.Delete()
|
||||
c.l.Info("bootstrapping a new zeus:", dir)
|
||||
return shell.New(ctx, c.l, "zeus", "bootstrap").
|
||||
Args(args...).
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package beam
|
||||
|
||||
type Database struct {
|
||||
Port int `yaml:"port"`
|
||||
Hostname string `yaml:"hostname"`
|
||||
Port int `json:"port" yaml:"port"`
|
||||
Hostname string `json:"hostname" yaml:"hostname"`
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/foomo/posh-providers/kubernets/kubectl"
|
||||
"github.com/foomo/posh/pkg/cache"
|
||||
"github.com/foomo/posh/pkg/command/tree"
|
||||
"github.com/foomo/posh/pkg/env"
|
||||
"github.com/foomo/posh/pkg/log"
|
||||
@ -20,6 +21,7 @@ type (
|
||||
l log.Logger
|
||||
k3d *K3d
|
||||
name string
|
||||
cache cache.Cache
|
||||
kubectl *kubectl.Kubectl
|
||||
commandTree tree.Root
|
||||
}
|
||||
@ -41,10 +43,11 @@ func CommandWithName(v string) CommandOption {
|
||||
// ~ Constructor
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
func NewCommand(l log.Logger, k3d *K3d, kubectl *kubectl.Kubectl, opts ...CommandOption) (*Command, error) {
|
||||
func NewCommand(l log.Logger, k3d *K3d, cache cache.Cache, kubectl *kubectl.Kubectl, opts ...CommandOption) (*Command, error) {
|
||||
inst := &Command{
|
||||
l: l.Named("k3d"),
|
||||
k3d: k3d,
|
||||
cache: cache,
|
||||
kubectl: kubectl,
|
||||
name: "k3d",
|
||||
}
|
||||
@ -347,12 +350,18 @@ func (c *Command) kubeconfig(ctx context.Context, r *readline.Readline) error {
|
||||
}
|
||||
|
||||
// delete cluster
|
||||
return shell.New(ctx, c.l, "k3d", "kubeconfig", "get", clusterCfg.AliasName()).
|
||||
if err := shell.New(ctx, c.l, "k3d", "kubeconfig", "get", clusterCfg.AliasName()).
|
||||
Args(">", c.kubectl.Cluster(name).Config("")).
|
||||
Args(r.Flags()...).
|
||||
Args(r.AdditionalArgs()...).
|
||||
Args(r.AdditionalFlags()...).
|
||||
Run()
|
||||
Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.cache.Clear()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type Workspace struct {
|
||||
Packages []string `yaml:"packages"`
|
||||
Packages []string `json:"packages" yaml:"packages"`
|
||||
}
|
||||
|
||||
func LoadWorkspace(filename string) (*Workspace, error) {
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type Workspace struct {
|
||||
Packages []string `yaml:"packages"`
|
||||
Packages []string `json:"packages" yaml:"packages"`
|
||||
}
|
||||
|
||||
func LoadWorkspace(filename string) (*Workspace, error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user