write test
Signed-off-by: Joe Hattori <joe2ninja21@gmail.com>
This commit is contained in:
parent
035664a0a7
commit
e89ddd745d
2 changed files with 39 additions and 20 deletions
|
|
@ -125,16 +125,20 @@ func runClone(cloneURL string, args []string) (target string, err error) {
|
|||
}
|
||||
|
||||
func repoClone(cmd *cobra.Command, args []string) error {
|
||||
ctx := contextForCommand(cmd)
|
||||
apiClient, err := apiClientForContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cloneURL := args[0]
|
||||
if !strings.Contains(cloneURL, ":") {
|
||||
if !strings.Contains(cloneURL, "/") {
|
||||
ctx := contextForCommand(cmd)
|
||||
currentUsername, err := ctx.AuthLogin()
|
||||
currentUser, err := api.CurrentLoginName(apiClient)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("currentUesrname: %s\n", currentUsername)
|
||||
cloneURL = currentUsername + "/" + cloneURL
|
||||
cloneURL = currentUser + "/" + cloneURL
|
||||
}
|
||||
cloneURL = formatRemoteURL(cmd, cloneURL)
|
||||
}
|
||||
|
|
@ -149,12 +153,6 @@ func repoClone(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
|
||||
if repo != nil {
|
||||
ctx := contextForCommand(cmd)
|
||||
apiClient, err := apiClientForContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
parentRepo, err = api.RepoParent(apiClient, repo)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue