diff --git a/commands/clone.go b/commands/clone.go index 9c7d914f..3093a332 100644 --- a/commands/clone.go +++ b/commands/clone.go @@ -59,7 +59,7 @@ func transformCloneArgs(args *Args) { var credential *github.Credential if owner == "" { configs := github.CurrentConfigs() - credential = configs.DefaultCredentials() + credential = configs.DefaultCredential() owner = credential.User } diff --git a/commands/create.go b/commands/create.go index 6d9e7f22..a5a9c5fd 100644 --- a/commands/create.go +++ b/commands/create.go @@ -2,11 +2,12 @@ package commands import ( "fmt" + "regexp" + "strings" + "github.com/github/hub/git" "github.com/github/hub/github" "github.com/github/hub/utils" - "regexp" - "strings" ) var cmdCreate = &Command{ @@ -73,7 +74,7 @@ func create(command *Command, args *Args) { } configs := github.CurrentConfigs() - credentials := configs.DefaultCredentials() + credentials := configs.DefaultCredential() owner := credentials.User if strings.Contains(newRepoName, "/") { diff --git a/commands/remote.go b/commands/remote.go index 96eb576b..3cc39b19 100644 --- a/commands/remote.go +++ b/commands/remote.go @@ -2,9 +2,10 @@ package commands import ( "fmt" + "regexp" + "github.com/github/hub/github" "github.com/github/hub/utils" - "regexp" ) var cmdRemote = &Command{ @@ -64,7 +65,7 @@ func transformRemoteArgs(args *Args) { isPriavte := parseRemotePrivateFlag(args) if len(words) == 2 && words[1] == "origin" { // gh add origin - credentials := github.CurrentConfigs().DefaultCredentials() + credentials := github.CurrentConfigs().DefaultCredential() owner = credentials.User name = repoName } else if len(words) == 2 { diff --git a/github/configs.go b/github/configs.go index 3d3bf8d9..2300e8c6 100644 --- a/github/configs.go +++ b/github/configs.go @@ -125,12 +125,8 @@ func saveTo(filename string, v interface{}) error { return enc.Encode(v) } -func loadFrom(filename string, c *Configs) error { - return loadFromFile(filename, c) -} - -func loadFromFile(filename string, v interface{}) (err error) { - _, err = toml.DecodeFile(filename, v) +func loadFrom(filename string, c *Configs) (err error) { + _, err = toml.DecodeFile(filename, c) return } @@ -153,7 +149,7 @@ func CurrentConfigs() *Configs { return c } -func (c *Configs) DefaultCredentials() (credential *Credential) { +func (c *Configs) DefaultCredential() (credential *Credential) { if GitHubHostEnv != "" { credential = c.PromptFor(GitHubHostEnv) } else if len(c.Credentials) > 0 {