Support local project open

This commit is contained in:
Ryan McGuire 2023-12-19 11:08:12 -05:00
parent cf2f125e86
commit c45bc61e41

View File

@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/gitlab"
) )
var projectOpenCmd = &cobra.Command{ var projectOpenCmd = &cobra.Command{
@ -58,10 +59,18 @@ func projectOpenCmdRun(cmd *cobra.Command, args []string) {
searchTerm = args[0] searchTerm = args[0]
} }
// Find a project // Try to open local project
project := fzfSearchProjectAliases(searchTerm) var project *gitlab.Project
if searchTerm == "." {
project, _ = cache.GetProjectFromCwd()
}
// Find a project if not local
if project == nil { if project == nil {
plog.Fatal("No project to open, nothing to do") project = fzfSearchProjectAliases(searchTerm)
if project == nil {
plog.Fatal("No project to open, nothing to do")
}
} }
// Check the project // Check the project