Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dagger: added environment variables #2244

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions completers/go_completer/cmd/mod_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ func init() {
"exclude": golang.ActionModuleSearch(),
"go": golang.ActionVersions(),
"module": carapace.ActionFiles(),
"replace": carapace.ActionMultiParts("=", func(c carapace.Context) carapace.Action {
"replace": carapace.ActionMultiPartsN("=", 2, func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
case 0:
return golang.ActionModules(golang.ModuleOpts{Direct: true, Indirect: true}).Invoke(c).Suffix("=").ToA()
case 1:
default:
return carapace.Batch(
carapace.ActionDirectories().ChdirF(traverse.Parent("go.mod")),
golang.ActionModuleSearch().Unless(condition.CompletingPath),
).ToA()
default:
return carapace.ActionValues()
}
}),
"require": golang.ActionModuleSearch(),
Expand Down
48 changes: 48 additions & 0 deletions pkg/actions/env/dagger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package env

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/conditions"
)

func init() {
knownVariables["dagger"] = func() variables {
return variables{
Condition: conditions.ConditionPath("dagger"),
Variables: map[string]string{
"DAGGER_CHECK": "check if dagger is up to date",
"DAGGER_NAME": "project name",
"DAGGER_TEMPLATE": "Template name",
"DAGGER_PRIVATE_KEY_FILE": "Private ssh key",
"DAGGER_PRIVATE_KEY_PASSWORD": "Private ssh key password",
"DAGGER_UPDATE": "Update to latest version of specified packages",
"DAGGER_PLAN": "Path to plan",
"DAGGER_CACHE_FROM": "External cache sources",
"DAGGER_CACHE_TO": "Cache destinations",
"DAGGER_DRY_RUN": "Dry run mode",
"DAGGER_NO_CACHE": "Disable caching",
"DAGGER_OUTPUT": "File path to write the action's output values",
"DAGGER_OUTPUT_FORMAT": "Format for output values",
"DAGGER_PLATFORM": "Set target build platform",
"DAGGER_WITH": "Set value of dagger value at runtime",
},
VariableCompletion: map[string]carapace.Action{
"DAGGER_CHECK": carapace.ActionValues("1"),
"DAGGER_NAME": carapace.ActionValues(),
"DAGGER_TEMPLATE": carapace.ActionValues(),
"DAGGER_PRIVATE_KEY_FILE": carapace.ActionFiles(),
"DAGGER_PRIVATE_KEY_PASSWORD": carapace.ActionValues(),
"DAGGER_UPDATE": carapace.ActionValues("1"),
"DAGGER_PLAN": carapace.ActionDirectories(),
"DAGGER_CACHE_FROM": carapace.ActionValues(),
"DAGGER_CACHE_TO": carapace.ActionValues(),
"DAGGER_DRY_RUN": carapace.ActionValues("1"),
"DAGGER_NO_CACHE": carapace.ActionValues("1"),
"DAGGER_OUTPUT": carapace.ActionFiles(),
"DAGGER_OUTPUT_FORMAT": carapace.ActionValues("plain", "json", "yaml"),
"DAGGER_PLATFORM": carapace.ActionValues(),
"DAGGER_WITH": carapace.ActionValues(),
},
}
}
}
Loading