git-project-manager/cmd/project_go.go
2023-12-08 23:13:17 -05:00

26 lines
668 B
Go

package cmd
import (
"github.com/spf13/cobra"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/gitlab"
)
var projectGoCmd = &cobra.Command{
Use: "go [fuzzy alias search]",
Short: "Go to a GitLab project",
Aliases: []string{"goto", "projects", "p"},
Args: cobra.MaximumNArgs(1),
ArgAliases: []string{"project"},
ValidArgsFunction: validAliasesFunc,
Long: projGoCmdLong,
Run: projectCmdRun,
}
func projectGoCmdRun(cmd *cobra.Command, args []string) {
goToProject(getProject(args))
}
func goToProject(project *gitlab.Project) {
cache.GoTo(project)
}