From 83b94ab8641c3df1dfe0a78101e106ce608368a8 Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Wed, 16 Sep 2020 16:59:20 +0000 Subject: [PATCH] Respect Flag Variable repoValue (#183) Flags respect repoValue followup of #178 Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/183 Reviewed-by: lafriks Reviewed-by: Andrew Thornton --- cmd/flags.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmd/flags.go b/cmd/flags.go index b54fc87..bf40a96 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -83,10 +83,8 @@ var AllDefaultFlags = append([]cli.Flag{ // initCommand returns repository and *Login based on flags func initCommand() (*Login, string, string) { - var ( - login *Login - repoPath string - ) + var login *Login + err := loadConfig(yamlConfigPath) if err != nil { log.Fatal("load config file failed ", yamlConfigPath) @@ -102,7 +100,7 @@ func initCommand() (*Login, string, string) { } if exist || len(repoValue) == 0 { - login, repoPath, err = curGitRepoPath(repoValue) + login, repoValue, err = curGitRepoPath(repoValue) if err != nil { log.Fatal(err.Error()) } @@ -115,7 +113,7 @@ func initCommand() (*Login, string, string) { } } - owner, repo := getOwnerAndRepo(repoPath, login.User) + owner, repo := getOwnerAndRepo(repoValue, login.User) return login, owner, repo }