git-project-manager/cmd/util_completion.go

21 lines
746 B
Go
Raw Normal View History

2023-12-08 21:52:26 +00:00
package cmd
import "github.com/spf13/cobra"
func validProjectsFunc(cmd *cobra.Command, args []string, toComplete string) (
[]string, cobra.ShellCompDirective) {
return cache.ProjectStrings(), cobra.ShellCompDirectiveDefault
}
func validAliasesFunc(cmd *cobra.Command, args []string, toComplete string) (
[]string, cobra.ShellCompDirective) {
return cache.AliasStrings(), cobra.ShellCompDirectiveDefault
}
func validProjectsOrAliasesFunc(cmd *cobra.Command, args []string, toComplete string) (
[]string, cobra.ShellCompDirective) {
projectStrings, _ := validAliasesFunc(cmd, args, toComplete)
aliasStrings, _ := validProjectsFunc(cmd, args, toComplete)
return append(projectStrings, aliasStrings...), cobra.ShellCompDirectiveDefault
}