23 lines
830 B
Go
23 lines
830 B
Go
package cmd
|
|
|
|
import "github.com/spf13/cobra"
|
|
|
|
func validProjectsFunc(cmd *cobra.Command, args []string, toComplete string) (
|
|
[]string, cobra.ShellCompDirective) {
|
|
initProjectCache(cmd, args)
|
|
return cache.ProjectStrings(toComplete), cobra.ShellCompDirectiveNoFileComp
|
|
}
|
|
|
|
func validAliasesFunc(cmd *cobra.Command, args []string, toComplete string) (
|
|
[]string, cobra.ShellCompDirective) {
|
|
initProjectCache(cmd, args)
|
|
return cache.AliasStrings(toComplete), cobra.ShellCompDirectiveNoFileComp
|
|
}
|
|
|
|
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
|
|
}
|