From 202e1a90385671bbdf223a582ca91369f94ec0cb Mon Sep 17 00:00:00 2001 From: rsteube Date: Sat, 17 Feb 2024 11:43:27 +0100 Subject: [PATCH] updated carapace --- completers/code_completer/cmd/action/extension.go | 4 ++-- completers/gradle_completer/cmd/root.go | 4 ++-- completers/pulumi_completer/cmd/action/urn.go | 4 ++-- completers/sdkmanager_completer/cmd/action/action.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- pkg/actions/fs/tar.go | 4 ++-- pkg/actions/tools/dbt/resource.go | 8 ++++---- pkg/actions/tools/gh/gh.go | 6 ++++-- pkg/actions/tools/mvn/project.go | 4 ++-- pkg/actions/tools/youtubedl/youtubedl.go | 6 +++--- 11 files changed, 26 insertions(+), 24 deletions(-) diff --git a/completers/code_completer/cmd/action/extension.go b/completers/code_completer/cmd/action/extension.go index bc0d82c9b7..eba955d498 100644 --- a/completers/code_completer/cmd/action/extension.go +++ b/completers/code_completer/cmd/action/extension.go @@ -7,7 +7,7 @@ import ( "time" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" "github.com/spf13/cobra" ) @@ -87,5 +87,5 @@ func ActionMicrosoftExtensions(category string) carapace.Action { return carapace.ActionCallback(func(c carapace.Context) carapace.Action { // Microsoft extensions are aliased and only found by the 'Microsoft' publisher (though the actual name differs) return ActionExtensionSearch(category).Invoke(carapace.Context{Value: "Microsoft"}).ToA() - }).Cache(24*time.Hour, cache.String(category)) + }).Cache(24*time.Hour, key.String(category)) } diff --git a/completers/gradle_completer/cmd/root.go b/completers/gradle_completer/cmd/root.go index 86858f1c7f..a56ef0d88c 100644 --- a/completers/gradle_completer/cmd/root.go +++ b/completers/gradle_completer/cmd/root.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" "github.com/rsteube/carapace/pkg/style" "github.com/rsteube/carapace/pkg/util" "github.com/spf13/cobra" @@ -126,7 +126,7 @@ func ActionTasks() carapace.Action { if buildConfig, err := locateBuildConfig(); err != nil { return "", err } else { - return cache.FileChecksum(buildConfig)() + return key.FileChecksum(buildConfig)() } }) } diff --git a/completers/pulumi_completer/cmd/action/urn.go b/completers/pulumi_completer/cmd/action/urn.go index 8871a2aa1b..714b791171 100644 --- a/completers/pulumi_completer/cmd/action/urn.go +++ b/completers/pulumi_completer/cmd/action/urn.go @@ -6,7 +6,7 @@ import ( "time" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" "github.com/spf13/cobra" ) @@ -47,7 +47,7 @@ func ActionUrns(cmd *cobra.Command) carapace.Action { return "", err } - return cache.String(absWd, stack)() + return key.String(absWd, stack)() }, ).Invoke(c).ToA() }) diff --git a/completers/sdkmanager_completer/cmd/action/action.go b/completers/sdkmanager_completer/cmd/action/action.go index 2b9f1a45fd..a0033b142d 100644 --- a/completers/sdkmanager_completer/cmd/action/action.go +++ b/completers/sdkmanager_completer/cmd/action/action.go @@ -6,7 +6,7 @@ import ( "time" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" "github.com/spf13/cobra" ) @@ -36,7 +36,7 @@ func ActionAvailablePackages(cmd *cobra.Command) carapace.Action { } } return carapace.ActionValuesDescribed(vals...) - }).Cache(1*time.Hour, cache.String(sdk_root, channel)) + }).Cache(1*time.Hour, key.String(sdk_root, channel)) }) } diff --git a/go.mod b/go.mod index f48948a022..531a4da3f6 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/pelletier/go-toml v1.9.5 - github.com/rsteube/carapace v0.49.2 + github.com/rsteube/carapace v0.50.0 github.com/rsteube/carapace-bridge v0.2.12 github.com/rsteube/carapace-shlex v0.1.2 github.com/rsteube/carapace-spec v0.15.0 diff --git a/go.sum b/go.sum index 41457d7e91..5cd50c60e9 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rsteube/carapace v0.49.2 h1:BMtZK/iGeGFF2cAIn+x0zM46ZbNt7OM+p18sHHXpXm4= -github.com/rsteube/carapace v0.49.2/go.mod h1:syVOvI8e2rEEK/9aMZxfWuHvcnQK/EcnTV4roClEnLE= +github.com/rsteube/carapace v0.50.0 h1:LO3ehEjcdbIx9owiyCiVfgL5A0cJPGq4X7c8V5DsA20= +github.com/rsteube/carapace v0.50.0/go.mod h1:syVOvI8e2rEEK/9aMZxfWuHvcnQK/EcnTV4roClEnLE= github.com/rsteube/carapace-bridge v0.2.12 h1:d1kgjgqrmgOa7lHLj/b/esJv692kHSQvTXhmzdx8dwQ= github.com/rsteube/carapace-bridge v0.2.12/go.mod h1:dT8ZptEIYd4zyg5CnPPr+hiLDukPu+lZLcNeyU2Wy2w= github.com/rsteube/carapace-pflag v0.2.0 h1:EYqFO9Haib3NDCPqKu0VxOGi9YQBkXk1IzlHdT0M0vw= diff --git a/pkg/actions/fs/tar.go b/pkg/actions/fs/tar.go index 8ef8fb0706..480b035baf 100644 --- a/pkg/actions/fs/tar.go +++ b/pkg/actions/fs/tar.go @@ -5,7 +5,7 @@ import ( "time" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" "github.com/rsteube/carapace/pkg/style" ) @@ -18,6 +18,6 @@ func ActionTarFileContents(file string) carapace.Action { return carapace.ActionExecCommand("tar", "--list", "--file", file)(func(output []byte) carapace.Action { lines := strings.Split(string(output), "\n") return carapace.ActionValues(lines[:len(lines)-1]...) - }).Cache(24*time.Hour, cache.FileStats(file)).Invoke(c).ToMultiPartsA("/").StyleF(style.ForPathExt) + }).Cache(24*time.Hour, key.FileStats(file)).Invoke(c).ToMultiPartsA("/").StyleF(style.ForPathExt) }) } diff --git a/pkg/actions/tools/dbt/resource.go b/pkg/actions/tools/dbt/resource.go index 8861d360af..e79cbf2f3d 100644 --- a/pkg/actions/tools/dbt/resource.go +++ b/pkg/actions/tools/dbt/resource.go @@ -8,7 +8,7 @@ import ( "time" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" "github.com/rsteube/carapace/pkg/style" "github.com/rsteube/carapace/pkg/util" ) @@ -36,8 +36,8 @@ func (o ResourceOpts) Default() ResourceOpts { return o } -func (o ResourceOpts) key() cache.Key { - return cache.String( +func (o ResourceOpts) key() key.Key { + return key.String( strconv.FormatBool(o.Analysis), strconv.FormatBool(o.Exposure), strconv.FormatBool(o.Metric), @@ -118,6 +118,6 @@ func ActionResources(opts ResourceOpts) carapace.Action { } } return carapace.ActionStyledValuesDescribed(vals...) - }).Cache(24*time.Hour, opts.key(), cache.FileStats(path)) // TODO opts , manifest.json constantly gets new modification time?? + }).Cache(24*time.Hour, opts.key(), key.FileStats(path)) // TODO opts , manifest.json constantly gets new modification time?? }).Tag("resources") } diff --git a/pkg/actions/tools/gh/gh.go b/pkg/actions/tools/gh/gh.go index d007ab1c46..ba009dbf33 100644 --- a/pkg/actions/tools/gh/gh.go +++ b/pkg/actions/tools/gh/gh.go @@ -1,7 +1,9 @@ // package gh contains github related actions package gh -import "github.com/rsteube/carapace/pkg/cache" +import ( + "github.com/rsteube/carapace/pkg/cache/key" +) type HostOpts struct { Host string @@ -27,4 +29,4 @@ type RepoOpts struct { Name string } -func (o RepoOpts) cacheKey() cache.Key { return cache.String(o.Host, o.Owner, o.Name) } +func (o RepoOpts) cacheKey() key.Key { return key.String(o.Host, o.Owner, o.Name) } diff --git a/pkg/actions/tools/mvn/project.go b/pkg/actions/tools/mvn/project.go index 76bd22658c..b55e31f5ab 100644 --- a/pkg/actions/tools/mvn/project.go +++ b/pkg/actions/tools/mvn/project.go @@ -4,7 +4,7 @@ import ( "strings" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" "github.com/rsteube/carapace/pkg/util" ) @@ -26,6 +26,6 @@ func ActionProjects(file string) carapace.Action { return carapace.ActionExecCommand("mvn", args...)(func(output []byte) carapace.Action { lines := strings.Split(string(output), "\n") return carapace.ActionValues(lines[:len(lines)-1]...) - }).Cache(-1, cache.FileStats(file)) + }).Cache(-1, key.FileStats(file)) }) } diff --git a/pkg/actions/tools/youtubedl/youtubedl.go b/pkg/actions/tools/youtubedl/youtubedl.go index d51c9b800b..72dbd1f88c 100644 --- a/pkg/actions/tools/youtubedl/youtubedl.go +++ b/pkg/actions/tools/youtubedl/youtubedl.go @@ -7,7 +7,7 @@ import ( "time" "github.com/rsteube/carapace" - "github.com/rsteube/carapace/pkg/cache" + "github.com/rsteube/carapace/pkg/cache/key" ) // ActionFormats completes formats @@ -35,7 +35,7 @@ func ActionFormats(url string) carapace.Action { } } return carapace.ActionValuesDescribed(vals...) - }).Cache(1*time.Hour, cache.String(c.Args[0])) + }).Cache(1*time.Hour, key.String(c.Args[0])) }) } @@ -64,6 +64,6 @@ func ActionSubLangs(url string) carapace.Action { } } return carapace.ActionValuesDescribed(vals...) - }).Cache(1*time.Hour, cache.String(c.Args[0])) + }).Cache(1*time.Hour, key.String(c.Args[0])) }) }