Fix first-time config gen, improve project_go

This commit is contained in:
2023-12-19 12:16:45 -05:00
parent c45bc61e41
commit 2082287bdd
3 changed files with 13 additions and 5 deletions

View File

@ -1,7 +1,7 @@
package cmd
const (
defGitlabHost = "gitlab.sweetwater.com"
defGitlabHost = "https://gitlab.com"
defLogLevel = "info"
defConfigPath = "~/.config/gitlab-project-manager.yaml"
)

View File

@ -56,6 +56,7 @@ func initProjectPath(cmd *cobra.Command, args []string) {
var err error
if conf.ProjectPath == "" {
conf.ProjectPath = config.DefaultConfig.ProjectPath
return
}
if conf.ProjectPath, err = resolvePath(conf.ProjectPath); err != nil {
plog.Error("Failed to determine project path", plog.Args("error", err))
@ -64,7 +65,7 @@ func initProjectPath(cmd *cobra.Command, args []string) {
_, err = os.Stat(conf.ProjectPath)
if err != nil {
plog.Error("Failed to stat project path, trying to create", plog.Args("error", err))
if err := os.Mkdir(conf.ProjectPath, 0750); err != nil {
if err := os.MkdirAll(conf.ProjectPath, 0750); err != nil {
plog.Error("Failed to create project path", plog.Args("error", err))
os.Exit(1)
}