mirror of
https://github.com/foomo/posh-providers.git
synced 2025-10-16 12:35:41 +00:00
feat: extend env helper
This commit is contained in:
parent
f59e381301
commit
0b423e6d5b
@ -347,7 +347,7 @@ func (c *Command) completePaths(ctx context.Context, filename string, dir bool)
|
||||
//nolint:forcetypeassert
|
||||
func (c *Command) paths(ctx context.Context, filename string, dir bool) []string {
|
||||
return c.cache.Get("paths-"+filename, func() any {
|
||||
if value, err := files.Find(ctx, ".", filename); err != nil {
|
||||
if value, err := files.Find(ctx, ".", filename, files.FindWithIgnore(`^(node_modules|\.\w*)$`)); err != nil {
|
||||
c.l.Debug("failed to walk files", err.Error())
|
||||
return []string{}
|
||||
} else if dir {
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/foomo/posh-providers/kubernets/kubectl"
|
||||
"github.com/foomo/posh-providers/onepassword"
|
||||
@ -161,8 +160,7 @@ func (c *Command) authLogin(ctx context.Context, r *readline.Readline) error {
|
||||
}
|
||||
|
||||
// resolve or retrieve service account access token
|
||||
keyFilename := path.Join(
|
||||
os.Getenv(env.ProjectRoot),
|
||||
keyFilename := env.Path(
|
||||
c.gcloud.ServiceAccountKeysPath(),
|
||||
fmt.Sprintf("%s.json", accountName),
|
||||
)
|
||||
|
||||
@ -78,7 +78,7 @@ func New(l log.Logger, cache cache.Cache, opts ...Option) (*GCloud, error) {
|
||||
return nil, errors.Wrapf(err, "failed to create directory %q", inst.cfg.ConfigPath)
|
||||
}
|
||||
|
||||
if err := os.Setenv("CLOUDSDK_CONFIG", path.Join(os.Getenv(env.ProjectRoot), inst.cfg.ConfigPath)); err != nil {
|
||||
if err := os.Setenv("CLOUDSDK_CONFIG", env.Path(inst.cfg.ConfigPath)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/foomo/posh/pkg/env"
|
||||
@ -47,7 +46,7 @@ func (c *Cluster) Env() string {
|
||||
}
|
||||
|
||||
func (c *Cluster) Config() string {
|
||||
return path.Join(os.Getenv(env.ProjectRoot), c.kubectl.cfg.ConfigPath, c.Name()+".yaml")
|
||||
return env.Path(c.kubectl.cfg.ConfigPath, c.Name()+".yaml")
|
||||
}
|
||||
|
||||
func (c *Cluster) ConfigExists() bool {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user