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) {
|
2023-12-29 13:55:06 +00:00
|
|
|
initProjectCache(cmd, args)
|
2023-12-20 16:23:11 +00:00
|
|
|
return cache.ProjectStrings(toComplete), cobra.ShellCompDirectiveNoFileComp
|
2023-12-08 21:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func validAliasesFunc(cmd *cobra.Command, args []string, toComplete string) (
|
|
|
|
[]string, cobra.ShellCompDirective) {
|
2023-12-20 16:23:11 +00:00
|
|
|
initProjectCache(cmd, args)
|
|
|
|
return cache.AliasStrings(toComplete), cobra.ShellCompDirectiveNoFileComp
|
2023-12-08 21:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|