From 6b01e88de093470de1d179ddd37bc1a65fefded5 Mon Sep 17 00:00:00 2001 From: rsteube Date: Mon, 12 Aug 2024 18:41:30 +0200 Subject: [PATCH] defaultActions: slim ActionFiles and ActionDirectories --- defaultActions.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/defaultActions.go b/defaultActions.go index 846a4fb2..1d2c1131 100644 --- a/defaultActions.go +++ b/defaultActions.go @@ -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).