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 <lafriks@noreply.gitea.io>
Reviewed-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
6543 2020-09-16 16:59:20 +00:00
parent 3c1bcdb1e2
commit 83b94ab864
1 changed files with 4 additions and 6 deletions

View File

@ -83,10 +83,8 @@ var AllDefaultFlags = append([]cli.Flag{
// initCommand returns repository and *Login based on flags // initCommand returns repository and *Login based on flags
func initCommand() (*Login, string, string) { func initCommand() (*Login, string, string) {
var ( var login *Login
login *Login
repoPath string
)
err := loadConfig(yamlConfigPath) err := loadConfig(yamlConfigPath)
if err != nil { if err != nil {
log.Fatal("load config file failed ", yamlConfigPath) log.Fatal("load config file failed ", yamlConfigPath)
@ -102,7 +100,7 @@ func initCommand() (*Login, string, string) {
} }
if exist || len(repoValue) == 0 { if exist || len(repoValue) == 0 {
login, repoPath, err = curGitRepoPath(repoValue) login, repoValue, err = curGitRepoPath(repoValue)
if err != nil { if err != nil {
log.Fatal(err.Error()) 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 return login, owner, repo
} }