diff --git a/cmd/project_open.go b/cmd/project_open.go index a86198e..3b56860 100644 --- a/cmd/project_open.go +++ b/cmd/project_open.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" + "gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/gitlab" ) var projectOpenCmd = &cobra.Command{ @@ -58,10 +59,18 @@ func projectOpenCmdRun(cmd *cobra.Command, args []string) { searchTerm = args[0] } - // Find a project - project := fzfSearchProjectAliases(searchTerm) + // Try to open local project + var project *gitlab.Project + if searchTerm == "." { + project, _ = cache.GetProjectFromCwd() + } + + // Find a project if not local 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