Skip to content

Commit

Permalink
actions: added env.ActionConfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Dec 11, 2024
1 parent f005832 commit 6259b3e
Show file tree
Hide file tree
Showing 30 changed files with 117 additions and 28 deletions.
3 changes: 2 additions & 1 deletion completers/bru_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -29,7 +30,7 @@ func init() {

carapace.Gen(runCmd).FlagCompletion(carapace.ActionMap{
"cacert": carapace.ActionFiles(),
"env": carapace.ActionValues(), // TODO
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env-var": carapace.ActionValues(), // TODO
"format": carapace.ActionValues("json", "junit", "html"),
"output": carapace.ActionFiles(),
Expand Down
2 changes: 2 additions & 0 deletions completers/cargo-watch_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/cargo"
"github.com/carapace-sh/carapace-bridge/pkg/actions/bridge"
Expand Down Expand Up @@ -53,6 +54,7 @@ func init() {

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"exec": bridge.ActionCarapaceBin("cargo").Split(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"features": cargo.ActionFeatures("").UniqueList(","),
"shell": bridge.ActionCarapaceBin().SplitP(),
"use-shell": os.ActionShells(),
Expand Down
2 changes: 2 additions & 0 deletions completers/circleci_completer/cmd/local_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/git"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -38,5 +39,6 @@ func init() {
}),
"checkout-key": carapace.ActionFiles(),
"config": carapace.ActionFiles(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
})
}
2 changes: 2 additions & 0 deletions completers/codecov_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/git"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -49,6 +50,7 @@ func init() {
// TODO rootDir for git actions
"branch": git.ActionRefs(git.RefOption{LocalBranches: true}),
"dir": carapace.ActionDirectories(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"file": carapace.ActionFiles(),
"rootDir": carapace.ActionDirectories(),
"tag": git.ActionRefs(git.RefOption{Tags: true}),
Expand Down
2 changes: 2 additions & 0 deletions completers/docker-compose_completer/cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/docker-compose_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -31,6 +32,7 @@ func init() {
// TODO workdir completion
// TODO index
carapace.Gen(execCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"user": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if len(c.Args) > 0 {
if index, err := execCmd.Flags().GetInt("index"); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions completers/docker-compose_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/docker-compose_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -41,6 +42,7 @@ func init() {

// TODO flag completion
carapace.Gen(runCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"volume": action.ActionVolumes(runCmd),
})

Expand Down
2 changes: 2 additions & 0 deletions completers/docker_completer/cmd/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/docker"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -126,6 +127,7 @@ func init() {
"cidfile": carapace.ActionFiles(),
"cpu-shares": carapace.ActionValues("0", "10", "100", "200", "500", "800", "1000"),
"device": carapace.ActionFiles(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"group-add": os.ActionGroups(),
"isolation": carapace.ActionValues("default", "hyperv", "process"),
Expand Down
2 changes: 2 additions & 0 deletions completers/docker_completer/cmd/container_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/docker"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -29,6 +30,7 @@ func init() {

carapace.Gen(container_execCmd).FlagCompletion(carapace.ActionMap{
"detach-keys": docker.ActionDetachKeys(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"user": os.ActionUserGroup(),
})
Expand Down
2 changes: 2 additions & 0 deletions completers/docker_completer/cmd/container_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/docker"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -130,6 +131,7 @@ func init() {
"cpu-shares": carapace.ActionValues("0", "10", "100", "200", "500", "800", "1000"),
"detach-keys": docker.ActionDetachKeys(),
"device": carapace.ActionFiles(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"group-add": os.ActionGroups(),
"isolation": carapace.ActionValues("default", "hyperv", "process"),
Expand Down
2 changes: 2 additions & 0 deletions completers/docker_completer/cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/docker"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -29,6 +30,7 @@ func init() {

carapace.Gen(execCmd).FlagCompletion(carapace.ActionMap{
"detach-keys": docker.ActionDetachKeys(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env-file": carapace.ActionFiles(),
})
}
2 changes: 2 additions & 0 deletions completers/docker_completer/cmd/service_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/docker"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -95,6 +96,7 @@ func init() {

carapace.Gen(service_createCmd).FlagCompletion(carapace.ActionMap{
"endpoint-mode": carapace.ActionValues("vip", "dnsrr"),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"group": os.ActionGroups(),
"isolation": carapace.ActionValues("default", "hyperv", "process"),
Expand Down
2 changes: 2 additions & 0 deletions completers/faas-cli_completer/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/faas-cli_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -39,6 +40,7 @@ func init() {
rootCmd.AddCommand(deployCmd)

carapace.Gen(deployCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"handler": carapace.ActionDirectories(),
"lang": action.ActionLanguageTemplates(),
"namespace": action.ActionNamespaces(),
Expand Down
2 changes: 2 additions & 0 deletions completers/faas-cli_completer/cmd/store_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/faas-cli_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -30,6 +31,7 @@ func init() {
storeCmd.AddCommand(store_deployCmd)

carapace.Gen(store_deployCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"namespace": action.ActionNamespaces(),
})

Expand Down
2 changes: 2 additions & 0 deletions completers/faas-cli_completer/cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/faas-cli_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -51,6 +52,7 @@ func init() {

carapace.Gen(upCmd).FlagCompletion(carapace.ActionMap{
"copy-extra": carapace.ActionDirectories(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"handler": carapace.ActionDirectories(),
"lang": action.ActionLanguageTemplates(),
"name": action.ActionFunctions(),
Expand Down
3 changes: 2 additions & 1 deletion completers/flatpak_completer/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -61,7 +62,7 @@ func init() {
"build-dir": carapace.ActionDirectories(),
// "device": carapace.ActionValues(),
// "disallow": carapace.ActionValues(),
// "env": carapace.ActionValues(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
// "env-fd": carapace.ActionValues(),
// "filesystem": carapace.ActionValues(),
// "metadata": carapace.ActionValues(),
Expand Down
3 changes: 2 additions & 1 deletion completers/flatpak_completer/cmd/buildFinish.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -61,7 +62,7 @@ func init() {
// "command": carapace.ActionValues().
// "device": carapace.ActionValues().
// "disallow": carapace.ActionValues().
// "env": carapace.ActionValues().
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
// "env-fd": carapace.ActionValues().
// "extension": carapace.ActionValues().
// "extension-priority": carapace.ActionValues().
Expand Down
3 changes: 2 additions & 1 deletion completers/flatpak_completer/cmd/override.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/flatpak"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -55,7 +56,7 @@ func init() {
// "allow": carapace.ActionValues(),
// "device": carapace.ActionValues(),
// "disallow": carapace.ActionValues(),
// "env": carapace.ActionValues(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
// "env-fd": carapace.ActionValues(),
// "filesystem": carapace.ActionValues(),
// "installation": carapace.ActionValues(),
Expand Down
3 changes: 2 additions & 1 deletion completers/flatpak_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/flatpak"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -85,7 +86,7 @@ func init() {
// "cwd": carapace.ActionValues(),
// "device": carapace.ActionValues(),
// "disallow": carapace.ActionValues(),
// "env": carapace.ActionValues(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
// "env-fd": carapace.ActionValues(),
// "filesystem": carapace.ActionValues(),
// "installation": carapace.ActionValues(),
Expand Down
2 changes: 2 additions & 0 deletions completers/kubectl_completer/cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -43,6 +44,7 @@ func init() {

// TODO flag completion
carapace.Gen(debugCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"profile": carapace.ActionValues("legacy", "general", "baseline", "netadmin", "restricted", "sysadmin"),
})
}
2 changes: 2 additions & 0 deletions completers/kubectl_completer/cmd/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -34,6 +35,7 @@ func init() {
rootCmd.AddCommand(kustomizeCmd)

carapace.Gen(kustomizeCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"output": carapace.ActionFiles(),
"reorder": carapace.ActionValues("legacy", "none"),
})
Expand Down
2 changes: 2 additions & 0 deletions completers/kubectl_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/kubectl"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -59,6 +60,7 @@ func init() {

carapace.Gen(runCmd).FlagCompletion(carapace.ActionMap{
"dry-run": kubectl.ActionDryRunModes(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"image-pull-policy": carapace.ActionValues("Never", "Always", "IfNotPresent"),
"output": kubectl.ActionOutputFormats(),
"restart": carapace.ActionValues("Always", "OnFailure", "Never"),
Expand Down
2 changes: 2 additions & 0 deletions completers/kubectl_completer/cmd/set_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/kubectl"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -40,6 +41,7 @@ func init() {

carapace.Gen(set_envCmd).FlagCompletion(carapace.ActionMap{
"dry-run": kubectl.ActionDryRunModes(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"filename": carapace.ActionFiles(),
"from": kubectl.ActionApiResourceResources(kubectl.ApiResourceResourcesOpts{}),
"output": kubectl.ActionOutputFormats(),
Expand Down
2 changes: 2 additions & 0 deletions completers/qmk_completer/cmd/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/qmk_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand All @@ -25,6 +26,7 @@ func init() {
rootCmd.AddCommand(compileCmd)

carapace.Gen(compileCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"keyboard": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return action.ActionKeyboards().Invoke(c).ToMultiPartsA("/")
}),
Expand Down
2 changes: 2 additions & 0 deletions completers/qmk_completer/cmd/flash.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/qmk_completer/cmd/action"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/spf13/cobra"
)

Expand All @@ -28,6 +29,7 @@ func init() {

carapace.Gen(flashCmd).FlagCompletion(carapace.ActionMap{
"bootloader": action.ActionBootloaders(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"keyboard": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return action.ActionKeyboards().Invoke(c).ToMultiPartsA("/")
}),
Expand Down
Loading

0 comments on commit 6259b3e

Please sign in to comment.