Skip to content

Commit

Permalink
Merge pull request #2062 from rsteube/winetricks-move-actions
Browse files Browse the repository at this point in the history
winetricks: move actions
  • Loading branch information
rsteube authored Dec 8, 2023
2 parents 1a150b0 + 7411edd commit be05799
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions completers/winetricks_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/completers/winetricks_completer/cmd/action"
"github.com/rsteube/carapace-bin/pkg/actions/tools/winetricks"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -37,7 +37,7 @@ func init() {
carapace.Gen(rootCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return carapace.Batch(
action.ActionVerbs(),
winetricks.ActionVerbs(),
carapace.ActionMultiParts("=", func(c carapace.Context) carapace.Action {
switch len(c.Parts) {
case 0:
Expand All @@ -50,7 +50,7 @@ func init() {
case "arch":
return carapace.ActionValues("32", "64")
case "wineprefix":
return action.ActionPrefixes()
return winetricks.ActionPrefixes()

}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package action
package winetricks

import (
"fmt"
Expand All @@ -7,6 +7,10 @@ import (
"github.com/rsteube/carapace"
)

// ActionPrefixes completes prefixes
//
// 3m_library (3M Cloud Library (3M Company, 2015) [downloadable])
// 7zip (7-Zip 19.00 (Igor Pavlov, 2019) [downloadable])
func ActionPrefixes() carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
home, err := os.UserHomeDir()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package action
package winetricks

import (
"regexp"
Expand All @@ -8,6 +8,7 @@ import (
"github.com/rsteube/carapace"
)

// ActionVerbs completes verbs
func ActionVerbs() carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return carapace.ActionExecCommand("winetricks", "list-all")(func(output []byte) carapace.Action {
Expand Down

0 comments on commit be05799

Please sign in to comment.