Skip to content

Commit

Permalink
Merge pull request #2535 from carapace-sh/update-carapace
Browse files Browse the repository at this point in the history
updated carapace to v1.3.0
  • Loading branch information
rsteube authored Sep 21, 2024
2 parents ef612b8 + 46363b4 commit f1f048f
Show file tree
Hide file tree
Showing 40 changed files with 52 additions and 50 deletions.
4 changes: 2 additions & 2 deletions completers/brew_completer/cmd/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func init() {
}

return carapace.Batch(
brew.ActionAllCasks().Unless(func(c carapace.Context) bool { return auditCmd.Flag("formula").Changed }),
brew.ActionAllFormulae().Unless(func(c carapace.Context) bool { return auditCmd.Flag("cask").Changed }),
brew.ActionAllCasks().Unless(auditCmd.Flag("formula").Changed),
brew.ActionAllFormulae().Unless(auditCmd.Flag("cask").Changed),
).ToA().FilterArgs()
}),
)
Expand Down
10 changes: 6 additions & 4 deletions completers/brew_completer/cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ func init() {
})

carapace.Gen(infoCmd).PositionalAnyCompletion(
carapace.Batch(
brew.ActionAllCasks().Unless(func(c carapace.Context) bool { return infoCmd.Flag("formula").Changed }),
brew.ActionAllFormulae().Unless(func(c carapace.Context) bool { return infoCmd.Flag("cask").Changed }),
).ToA().FilterArgs(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return carapace.Batch(
brew.ActionAllCasks().Unless(infoCmd.Flag("formula").Changed),
brew.ActionAllFormulae().Unless(infoCmd.Flag("cask").Changed),
).ToA().FilterArgs()
}),
)
}
2 changes: 1 addition & 1 deletion completers/cargo_completer/cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func init() {
default:
return carapace.ActionValues()
}
}).Unless(condition.CompletingPathS),
}).UnlessF(condition.CompletingPathS),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/clamdtop_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func init() {
default:
return carapace.ActionValues()
}
}).Unless(condition.CompletingPath),
}).UnlessF(condition.CompletingPath),
).ToA(),
)

Expand Down
2 changes: 1 addition & 1 deletion completers/code_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func init() {
"install-extension": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return carapace.Batch(
carapace.ActionFiles(".vsix"),
action.ActionExtensionSearch(rootCmd.Flag("category").Value.String()).Unless(condition.CompletingPathS),
action.ActionExtensionSearch(rootCmd.Flag("category").Value.String()).UnlessF(condition.CompletingPathS),
).ToA()
}),
"locale": os.ActionLocales(),
Expand Down
4 changes: 2 additions & 2 deletions completers/docker-compose_completer/cmd/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func init() {
return action.ActionFiles(cpCmd, c.Parts[0], index)
}
}
}).Unless(condition.CompletingPath),
}).UnlessF(condition.CompletingPath),
).ToA(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if !condition.File(c.Args[0])(c) {
Expand All @@ -49,7 +49,7 @@ func init() {
return carapace.ActionMultiParts(":", func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
case 0:
return action.ActionServices(cpCmd).Suffix(":").Unless(condition.CompletingPath)
return action.ActionServices(cpCmd).Suffix(":").UnlessF(condition.CompletingPath)
case 1:
if index, err := cpCmd.Flags().GetInt("index"); err != nil {
return carapace.ActionMessage(err.Error())
Expand Down
2 changes: 1 addition & 1 deletion completers/docker_completer/cmd/container_cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func init() {
carapace.Gen(container_cpCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
docker.ActionContainerPath().Unless(condition.CompletingPath),
docker.ActionContainerPath().UnlessF(condition.CompletingPath),
).ToA(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if condition.File(c.Args[0])(c) {
Expand Down
2 changes: 1 addition & 1 deletion completers/gh_completer/cmd/codespace_cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func init() {
action.ActionCodespacePath(
codespace_cpCmd.Flag("codespace").Value.String(),
codespace_cpCmd.Flag("expand").Changed,
).Prefix("remote:").Unless(condition.CompletingPath),
).Prefix("remote:").UnlessF(condition.CompletingPath),
).ToA(),
)
}
4 changes: 2 additions & 2 deletions completers/git_completer/cmd/blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ func init() {
carapace.Gen(blameCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
git.ActionRefs(git.RefOption{}.Default()).Unless(condition.CompletingPath),
git.ActionRefs(git.RefOption{}.Default()).UnlessF(condition.CompletingPath),
).ToA(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return git.ActionRefFiles(c.Args[0]).Unless(condition.File(c.Args[0]))
return git.ActionRefFiles(c.Args[0]).UnlessF(condition.File(c.Args[0]))
}),
)

Expand Down
4 changes: 2 additions & 2 deletions completers/git_completer/cmd/gui_blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ func init() {
carapace.Gen(gui_blameCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
git.ActionRefs(git.RefOption{}.Default()).Unless(condition.CompletingPath),
git.ActionRefs(git.RefOption{}.Default()).UnlessF(condition.CompletingPath),
).ToA(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return git.ActionRefFiles(c.Args[0]).Unless(condition.File(c.Args[0]))
return git.ActionRefFiles(c.Args[0]).UnlessF(condition.File(c.Args[0]))
}),
)
}
2 changes: 1 addition & 1 deletion completers/git_completer/cmd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func init() {
carapace.Gen(logCmd).PositionalAnyCompletion(
carapace.Batch(
carapace.ActionFiles(),
git.ActionRefRanges(git.RefOption{}.Default()).Unless(condition.CompletingPath),
git.ActionRefRanges(git.RefOption{}.Default()).UnlessF(condition.CompletingPath),
).ToA(),
)

Expand Down
2 changes: 1 addition & 1 deletion completers/git_completer/cmd/replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers_release/git_completer/cmd/common"
"github.com/carapace-sh/carapace-bin/completers/git_completer/cmd/common"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/git"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion completers/git_completer/cmd/shortlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func init() {
carapace.Gen(shortlogCmd).PositionalAnyCompletion(
carapace.Batch(
carapace.ActionFiles(),
git.ActionRefRanges(git.RefOption{}.Default()).Unless(condition.CompletingPath),
git.ActionRefRanges(git.RefOption{}.Default()).UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/git_completer/cmd/whatchanged.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func init() {
carapace.Gen(whatchangedCmd).PositionalAnyCompletion(
carapace.Batch(
carapace.ActionFiles(),
git.ActionRefRanges(git.RefOption{}.Default()).Unless(condition.CompletingPath),
git.ActionRefRanges(git.RefOption{}.Default()).UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/go-tool-doc_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func init() {
carapace.Gen(rootCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionDirectories(),
golang.ActionPackages().Unless(condition.CompletingPath),
golang.ActionPackages().UnlessF(condition.CompletingPath),
).ToA(),
carapace.ActionMultiParts(".", func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
Expand Down
2 changes: 1 addition & 1 deletion completers/go_completer/cmd/mod_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func init() {
default:
return carapace.Batch(
carapace.ActionDirectories().ChdirF(traverse.Parent("go.mod")),
golang.ActionModuleSearch().Unless(condition.CompletingPath),
golang.ActionModuleSearch().UnlessF(condition.CompletingPath),
).ToA()
}
}),
Expand Down
2 changes: 1 addition & 1 deletion completers/go_completer/cmd/work_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func init() {
case 1:
return carapace.Batch(
carapace.ActionDirectories().ChdirF(traverse.Parent("go.work")),
golang.ActionModuleSearch().Unless(condition.CompletingPath),
golang.ActionModuleSearch().UnlessF(condition.CompletingPath),
).ToA()
default:
return carapace.ActionValues()
Expand Down
2 changes: 1 addition & 1 deletion completers/helm_completer/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func init() {
carapace.ActionValues(),
carapace.Batch(
carapace.ActionDirectories(),
helm.ActionRepositoryCharts().Unless(condition.CompletingPath),
helm.ActionRepositoryCharts().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/helm_completer/cmd/show_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func init() {
carapace.Gen(show_allCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
helm.ActionRepositoryCharts().Unless(condition.CompletingPath),
helm.ActionRepositoryCharts().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/helm_completer/cmd/show_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func init() {
carapace.Gen(show_chartCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
helm.ActionRepositoryCharts().Unless(condition.CompletingPath),
helm.ActionRepositoryCharts().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/helm_completer/cmd/show_readme.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func init() {
carapace.Gen(show_readmeCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
helm.ActionRepositoryCharts().Unless(condition.CompletingPath),
helm.ActionRepositoryCharts().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/helm_completer/cmd/show_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func init() {
carapace.Gen(show_valuesCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
helm.ActionRepositoryCharts().Unless(condition.CompletingPath),
helm.ActionRepositoryCharts().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/helm_completer/cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func init() {
action.ActionReleases(upgradeCmd),
carapace.Batch(
carapace.ActionFiles(),
helm.ActionRepositoryCharts().Unless(condition.CompletingPath),
helm.ActionRepositoryCharts().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/kubectl_completer/cmd/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ func ActionPathOrContainer() carapace.Action {
default:
return carapace.ActionValues()
}
}).Unless(condition.CompletingPath),
}).UnlessF(condition.CompletingPath),
).ToA()
}
2 changes: 1 addition & 1 deletion completers/minikube_completer/cmd/image_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func init() {
carapace.Gen(image_loadCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
docker.ActionRepositoryTags().Unless(condition.CompletingPath),
docker.ActionRepositoryTags().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/npm_completer/cmd/cache_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func init() {
carapace.Gen(cache_addCmd).PositionalAnyCompletion(
carapace.Batch(
carapace.ActionFiles(),
action.ActionPackages(cache_addCmd).Unless(condition.CompletingPath),
action.ActionPackages(cache_addCmd).UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/npm_completer/cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func init() {
carapace.Gen(diffCmd).FlagCompletion(carapace.ActionMap{
"diff": carapace.Batch(
carapace.ActionFiles(),
action.ActionPackages(diffCmd).Unless(condition.CompletingPath),
action.ActionPackages(diffCmd).UnlessF(condition.CompletingPath),
).ToA(),
})
}
2 changes: 1 addition & 1 deletion completers/npm_completer/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func init() {
carapace.Gen(installCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
action.ActionPackages(installCmd).Unless(condition.CompletingPath),
action.ActionPackages(installCmd).UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/npm_completer/cmd/installTest.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func init() {
carapace.Gen(installTestCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
action.ActionPackages(installTestCmd).Unless(condition.CompletingPath),
action.ActionPackages(installTestCmd).UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/npm_completer/cmd/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func init() {
carapace.Gen(linkCmd).PositionalCompletion(
carapace.Batch(
carapace.ActionFiles(),
action.ActionPackages(linkCmd).Unless(condition.CompletingPath),
action.ActionPackages(linkCmd).UnlessF(condition.CompletingPath),
).ToA(),
)
}
4 changes: 2 additions & 2 deletions completers/pamac_completer/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func init() {
carapace.Gen(installCmd).PositionalAnyCompletion(
carapace.Batch(
carapace.ActionFiles(".pkg", ".pkg.tar.gz", ".pkg.tar.xz", ".pkg.tar.zst"),
pamac.ActionPackageGroups().Unless(condition.CompletingPath),
pamac.ActionPackageSearch().Unless(condition.CompletingPath),
pamac.ActionPackageGroups().UnlessF(condition.CompletingPath),
pamac.ActionPackageSearch().UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/pip_completer/cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func init() {
carapace.Batch(
carapace.ActionFiles(),
// TODO support multiple index urls (--index-url) and update caching accordingly
pip.ActionPackageSearch().Unless(condition.CompletingPath),
pip.ActionPackageSearch().UnlessF(condition.CompletingPath),
).ToA(),
)
}
4 changes: 2 additions & 2 deletions completers/pnpm_completer/cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func init() {

return carapace.Batch(
carapace.ActionFiles(),
npm.ActionPackageSearch("").Unless(condition.CompletingPath),
git.ActionRepositorySearch(git.SearchOpts{}.Default()).Unless(condition.CompletingPath),
npm.ActionPackageSearch("").UnlessF(condition.CompletingPath),
git.ActionRepositorySearch(git.SearchOpts{}.Default()).UnlessF(condition.CompletingPath),
).ToA()
}),
)
Expand Down
2 changes: 1 addition & 1 deletion completers/rsync_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ func init() {
default:
return carapace.ActionValues()
}
}).Unless(condition.CompletingPath),
}).UnlessF(condition.CompletingPath),
).ToA(),
)
}
2 changes: 1 addition & 1 deletion completers/tig_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func init() {
carapace.Gen(rootCmd).PositionalAnyCompletion(
carapace.Batch(
carapace.ActionFiles(),
git.ActionRefs(git.RefOption{}.Default()).Unless(condition.CompletingPath),
git.ActionRefs(git.RefOption{}.Default()).UnlessF(condition.CompletingPath),
).ToA(),
)

Expand Down
2 changes: 1 addition & 1 deletion completers/vagrant_completer/cmd/box_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func init() {
provider := box_addCmd.Flag("provider").Value.String()
return carapace.Batch(
carapace.ActionFiles(".box", ".json"),
vagrant.ActionCloudBoxSearch(provider).Unless(condition.CompletingPath),
vagrant.ActionCloudBoxSearch(provider).UnlessF(condition.CompletingPath),
).ToA()
}),
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/carapace-sh/carapace-bin
go 1.23.0

require (
github.com/carapace-sh/carapace v1.2.0
github.com/carapace-sh/carapace v1.3.0
github.com/carapace-sh/carapace-bridge v1.0.2
github.com/carapace-sh/carapace-shlex v1.0.1
github.com/carapace-sh/carapace-spec v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPn
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/carapace-sh/carapace v1.2.0 h1:vjN1MgKXQrOMB2ZA+OTl41p7YMUOgxv7+bSO51wROyg=
github.com/carapace-sh/carapace v1.2.0/go.mod h1:djegtVDi/3duSAqZNU+/nCq7XtDRMRZUb5bW0O/HnEs=
github.com/carapace-sh/carapace v1.3.0 h1:mvi6hPcU+Umd+9Z0IRA8oehKStsTWOS0SSQMhzUKfvw=
github.com/carapace-sh/carapace v1.3.0/go.mod h1:djegtVDi/3duSAqZNU+/nCq7XtDRMRZUb5bW0O/HnEs=
github.com/carapace-sh/carapace-bridge v1.0.2 h1:q2yVrhpxjxA0p3ZcGHpjns99KE9lCrJLc3Zgaa7kMK4=
github.com/carapace-sh/carapace-bridge v1.0.2/go.mod h1:1tuz7tWpJeGMHa6Yvwlkb9QCNqxRD5VsS/4iZdK9ofQ=
github.com/carapace-sh/carapace-pflag v1.0.0 h1:uJMhl+vwEM/Eb0UdxZUuv4jo4rUAyPijkRGP5gfCuCE=
Expand Down
2 changes: 1 addition & 1 deletion pkg/actions/tools/git/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func ActionConfigValues(config string) carapace.Action {
switch splitted[0] {
case "alias":
return carapace.Batch(
bridge.ActionCarapaceBin().Split().Prefix("!").Unless(func(c carapace.Context) bool {
bridge.ActionCarapaceBin().Split().Prefix("!").UnlessF(func(c carapace.Context) bool {
return !strings.HasPrefix(c.Value, "!")
}),
bridge.ActionCarapaceBin("git").Split(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/actions/tools/syft/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func ActionSources() carapace.Action {
return carapace.Batch(
carapace.ActionFiles(),
docker.ActionRepositoryTags().Unless(condition.CompletingPath),
docker.ActionRepositoryTags().UnlessF(condition.CompletingPath),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
splitted := strings.SplitN(c.Value, ":", 2)
switch len(splitted) {
Expand Down

0 comments on commit f1f048f

Please sign in to comment.