fmt.Fprintf(os.Stdout,"You have an existing certificate at %s which login would overwrite.\nIf this is intentional, please move or delete that file then run this command again.",path)
returnnil
}elseiferr!=nil{
returnerr
}
loginURL,err:=url.Parse(baseLoginURL)
iferr!=nil{
// shouldn't happen, URL is hardcoded
returnerr
}
_,err=transfer.Run(c,loginURL,"cert",path,false)
iferr!=nil{
fmt.Fprintf(os.Stderr,"Failed to write the certificate due to the following error:\n%v\n\nYour browser will download the certificate instead. You will have to manually\ncopy it to the following path:\n\n%s",err,path)
returnerr
}
fmt.Fprintf(os.Stdout,"You have successfully logged in.\nIf you wish to copy your credentials to a server, they have been saved to:\n%s\n",path)