Skip to content

Commit

Permalink
dagger: added environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Feb 14, 2024
1 parent 6636d6a commit d7a50a9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
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(),
},
}
}
}

0 comments on commit d7a50a9

Please sign in to comment.