Skip to content

Commit

Permalink
Merge pull request #1036 from carapace-sh/defaultactions-slim
Browse files Browse the repository at this point in the history
defaultActions: slim ActionFiles and ActionDirectories
  • Loading branch information
rsteube authored Aug 12, 2024
2 parents 3704c15 + 6b01e88 commit 15e8644
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions defaultActions.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,18 @@ func ActionExecute(cmd *cobra.Command) Action {

// ActionDirectories completes directories.
func ActionDirectories() Action {
return ActionCallback(func(c Context) Action {
return actionPath([]string{""}, true).Invoke(c).ToMultiPartsA("/").StyleF(style.ForPath)
}).Tag("directories")
return actionPath([]string{""}, true).
MultiParts("/").
StyleF(style.ForPath).
Tag("directories")
}

// ActionFiles completes files with optional suffix filtering.
func ActionFiles(suffix ...string) Action {
return ActionCallback(func(c Context) Action {
return actionPath(suffix, false).Invoke(c).ToMultiPartsA("/").StyleF(style.ForPath)
}).Tag("files")
return actionPath(suffix, false).
MultiParts("/").
StyleF(style.ForPath).
Tag("files")
}

// ActionValues completes arbitrary keywords (values).
Expand Down

0 comments on commit 15e8644

Please sign in to comment.