Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Dec 11, 2024
1 parent 45b00b5 commit deb9fb2
Show file tree
Hide file tree
Showing 29 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion completers/bru_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {

carapace.Gen(runCmd).FlagCompletion(carapace.ActionMap{
"cacert": carapace.ActionFiles(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"env-var": carapace.ActionValues(), // TODO
"format": carapace.ActionValues("json", "junit", "html"),
"output": carapace.ActionFiles(),
Expand Down
2 changes: 1 addition & 1 deletion completers/cargo-watch_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func init() {

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"exec": bridge.ActionCarapaceBin("cargo").Split(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"features": cargo.ActionFeatures("").UniqueList(","),
"shell": bridge.ActionCarapaceBin().SplitP(),
"use-shell": os.ActionShells(),
Expand Down
2 changes: 1 addition & 1 deletion completers/circleci_completer/cmd/local_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ func init() {
}),
"checkout-key": carapace.ActionFiles(),
"config": carapace.ActionFiles(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
})
}
2 changes: 1 addition & 1 deletion completers/codecov_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +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()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"file": carapace.ActionFiles(),
"rootDir": carapace.ActionDirectories(),
"tag": git.ActionRefs(git.RefOption{Tags: true}),
Expand Down
2 changes: 1 addition & 1 deletion completers/docker-compose_completer/cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func init() {
// TODO workdir completion
// TODO index
carapace.Gen(execCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.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: 1 addition & 1 deletion completers/docker-compose_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func init() {

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

Expand Down
2 changes: 1 addition & 1 deletion completers/docker_completer/cmd/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +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": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"group-add": os.ActionGroups(),
"isolation": carapace.ActionValues("default", "hyperv", "process"),
Expand Down
2 changes: 1 addition & 1 deletion completers/docker_completer/cmd/container_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {

carapace.Gen(container_execCmd).FlagCompletion(carapace.ActionMap{
"detach-keys": docker.ActionDetachKeys(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"user": os.ActionUserGroup(),
})
Expand Down
2 changes: 1 addition & 1 deletion completers/docker_completer/cmd/container_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +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": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"group-add": os.ActionGroups(),
"isolation": carapace.ActionValues("default", "hyperv", "process"),
Expand Down
2 changes: 1 addition & 1 deletion completers/docker_completer/cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func init() {

carapace.Gen(execCmd).FlagCompletion(carapace.ActionMap{
"detach-keys": docker.ActionDetachKeys(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"env-file": carapace.ActionFiles(),
})
}
2 changes: 1 addition & 1 deletion completers/docker_completer/cmd/service_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func init() {

carapace.Gen(service_createCmd).FlagCompletion(carapace.ActionMap{
"endpoint-mode": carapace.ActionValues("vip", "dnsrr"),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"env-file": carapace.ActionFiles(),
"group": os.ActionGroups(),
"isolation": carapace.ActionValues("default", "hyperv", "process"),
Expand Down
2 changes: 1 addition & 1 deletion completers/faas-cli_completer/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func init() {
rootCmd.AddCommand(deployCmd)

carapace.Gen(deployCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"handler": carapace.ActionDirectories(),
"lang": action.ActionLanguageTemplates(),
"namespace": action.ActionNamespaces(),
Expand Down
2 changes: 1 addition & 1 deletion completers/faas-cli_completer/cmd/store_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func init() {
storeCmd.AddCommand(store_deployCmd)

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

Expand Down
2 changes: 1 addition & 1 deletion completers/faas-cli_completer/cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func init() {

carapace.Gen(upCmd).FlagCompletion(carapace.ActionMap{
"copy-extra": carapace.ActionDirectories(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"handler": carapace.ActionDirectories(),
"lang": action.ActionLanguageTemplates(),
"name": action.ActionFunctions(),
Expand Down
2 changes: 1 addition & 1 deletion completers/flatpak_completer/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func init() {
"build-dir": carapace.ActionDirectories(),
// "device": carapace.ActionValues(),
// "disallow": carapace.ActionValues(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
// "env-fd": carapace.ActionValues(),
// "filesystem": carapace.ActionValues(),
// "metadata": carapace.ActionValues(),
Expand Down
2 changes: 1 addition & 1 deletion completers/flatpak_completer/cmd/buildFinish.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func init() {
// "command": carapace.ActionValues().
// "device": carapace.ActionValues().
// "disallow": carapace.ActionValues().
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
// "env-fd": carapace.ActionValues().
// "extension": carapace.ActionValues().
// "extension-priority": carapace.ActionValues().
Expand Down
2 changes: 1 addition & 1 deletion completers/flatpak_completer/cmd/override.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func init() {
// "allow": carapace.ActionValues(),
// "device": carapace.ActionValues(),
// "disallow": carapace.ActionValues(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
// "env-fd": carapace.ActionValues(),
// "filesystem": carapace.ActionValues(),
// "installation": carapace.ActionValues(),
Expand Down
2 changes: 1 addition & 1 deletion completers/flatpak_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func init() {
// "cwd": carapace.ActionValues(),
// "device": carapace.ActionValues(),
// "disallow": carapace.ActionValues(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
// "env-fd": carapace.ActionValues(),
// "filesystem": carapace.ActionValues(),
// "installation": carapace.ActionValues(),
Expand Down
2 changes: 1 addition & 1 deletion completers/kubectl_completer/cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func init() {

// TODO flag completion
carapace.Gen(debugCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"profile": carapace.ActionValues("legacy", "general", "baseline", "netadmin", "restricted", "sysadmin"),
})
}
2 changes: 1 addition & 1 deletion completers/kubectl_completer/cmd/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func init() {
rootCmd.AddCommand(kustomizeCmd)

carapace.Gen(kustomizeCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"output": carapace.ActionFiles(),
"reorder": carapace.ActionValues("legacy", "none"),
})
Expand Down
2 changes: 1 addition & 1 deletion completers/kubectl_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func init() {

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

carapace.Gen(set_envCmd).FlagCompletion(carapace.ActionMap{
"dry-run": kubectl.ActionDryRunModes(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"filename": carapace.ActionFiles(),
"from": kubectl.ActionApiResourceResources(kubectl.ApiResourceResourcesOpts{}),
"output": kubectl.ActionOutputFormats(),
Expand Down
2 changes: 1 addition & 1 deletion completers/qmk_completer/cmd/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func init() {
rootCmd.AddCommand(compileCmd)

carapace.Gen(compileCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"keyboard": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return action.ActionKeyboards().Invoke(c).ToMultiPartsA("/")
}),
Expand Down
2 changes: 1 addition & 1 deletion completers/qmk_completer/cmd/flash.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func init() {

carapace.Gen(flashCmd).FlagCompletion(carapace.ActionMap{
"bootloader": action.ActionBootloaders(),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"keyboard": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return action.ActionKeyboards().Invoke(c).ToMultiPartsA("/")
}),
Expand Down
2 changes: 1 addition & 1 deletion completers/run0_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func init() {
"background": color.ActionAnsiBackgroundColors(false),
"chdir": carapace.ActionDirectories(),
"group": os.ActionGroups(),
"setenv": env.ActionConfigs(env.ConfigOpts{}.Default()),
"setenv": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"user": os.ActionUsers(),
})

Expand Down
2 changes: 1 addition & 1 deletion completers/set-env_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ func init() {
carapace.Gen(rootCmd).Standalone()

carapace.Gen(rootCmd).PositionalAnyCompletion(
env.ActionConfigs(env.ConfigOpts{Attached: false, User: true}),
env.ActionSetEnvs(env.SetEnvOpts{Attached: false, User: true}),
)
}
4 changes: 2 additions & 2 deletions completers/vercel_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func init() {
rootCmd.PersistentFlags().BoolP("help", "h", false, "Output usage information")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"build-env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"build-env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
"global-config": carapace.ActionDirectories(),
"local-config": carapace.ActionFiles(),
"regions": action.ActionRegions().UniqueList(","),
Expand Down
2 changes: 1 addition & 1 deletion completers/volta_completer/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ func init() {
rootCmd.AddCommand(runCmd)

carapace.Gen(runCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionConfigs(env.ConfigOpts{}.Default()),
"env": env.ActionSetEnvs(env.SetEnvOpts{}.Default()),
})
}
10 changes: 5 additions & 5 deletions pkg/actions/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,21 @@ func loadCustomVariables(file string) (*variables, error) {
return &v, nil
}

type ConfigOpts struct {
// complete values attached (`KEY=VALUE`) or positional (`KEY VALUE`)
type SetEnvOpts struct {
// complete values attached (`KEY[=VALUE]`) or positional (`KEY VALUE`)
Attached bool
// include user defined variables
User bool // TODO
}

func (o ConfigOpts) Default() ConfigOpts {
func (o SetEnvOpts) Default() SetEnvOpts {
o.Attached = true
o.User = true
return o
}

// ActionConfigs completes environment variable configurations
func ActionConfigs(opts ConfigOpts) carapace.Action {
// ActionSetEnvs completes environment variables setters
func ActionSetEnvs(opts SetEnvOpts) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
keysAction := carapace.Batch(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
Expand Down

0 comments on commit deb9fb2

Please sign in to comment.