Support local project open
This commit is contained in:
parent
cf2f125e86
commit
c45bc61e41
@ -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,11 +59,19 @@ 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 {
|
||||||
|
project = fzfSearchProjectAliases(searchTerm)
|
||||||
if project == nil {
|
if project == nil {
|
||||||
plog.Fatal("No project to open, nothing to do")
|
plog.Fatal("No project to open, nothing to do")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check the project
|
// Check the project
|
||||||
path := cache.GetProjectPath(project)
|
path := cache.GetProjectPath(project)
|
||||||
|
Loading…
Reference in New Issue
Block a user