@@ -30,15 +30,15 @@ var tag string
3030func init () {
3131 devctlCmd .AddCommand (cloneCmd )
3232
33- cloneCmd .Flags ().BoolVarP (& gitlab , "gitlab" , "l" , false , "Clone from gitlab url " )
33+ cloneCmd .Flags ().BoolVarP (& gitlab , "gitlab" , "l" , false , "Clone from gitlab URL " )
3434 cloneCmd .Flags ().StringVarP (& tag , "tag" , "t" , "" , "subfolder to clone repo to" )
3535}
3636
3737type cloneConfig struct {
3838 Repo string
3939 User string
4040 Host string
41- Url string
41+ URL string
4242 SourceDir string
4343 command * cobra.Command
4444}
@@ -58,7 +58,7 @@ func clone(cmd *cobra.Command, args []string) {
5858 cfg .parseArgs (args )
5959
6060 cfg .setSourceDir ()
61- cfg .setUrl ()
61+ cfg .setURL ()
6262 // validate(cfg)
6363 cfg .clone ()
6464}
@@ -86,18 +86,18 @@ func isFullURL(s string) bool {
8686 return false
8787}
8888
89- func (cfg * cloneConfig ) parseFullURL (url string ) {
89+ func (cfg * cloneConfig ) parseFullURL (URL string ) {
9090 r , _ := regexp .Compile (`^(?:git@|https?:\/\/(?:.*?@)?)([^\/:]*)(?:\/|:)(.*?)\/(.*?)(?:.git)?$` )
91- res := r .FindAllStringSubmatch (url , - 1 )
91+ res := r .FindAllStringSubmatch (URL , - 1 )
9292
9393 cfg .Host = res [0 ][1 ]
9494 cfg .User = res [0 ][2 ]
9595 cfg .Repo = res [0 ][3 ]
96- cfg .Url = url
96+ cfg .URL = URL
9797}
9898
9999func (cfg * cloneConfig ) github () {
100- cfg .Url = "github.com"
100+ cfg .URL = "github.com"
101101 cfg .Host = "github.com"
102102 user := parser .DevctlConfig .GithubUser
103103 if user != "" {
@@ -106,11 +106,11 @@ func (cfg *cloneConfig) github() {
106106}
107107
108108func (cfg * cloneConfig ) gitlab () {
109- cfg .Url = parser .DevctlConfig .GitlabURL
109+ cfg .URL = parser .DevctlConfig .GitlabURL
110110 cfg .Host = parser .DevctlConfig .GitlabURL
111- if cfg .Url == "" {
112- printer .Warning ("Gitlab url not provided, falling back to gitlab.com" )
113- cfg .Url = "gitlab.com"
111+ if cfg .URL == "" {
112+ printer .Warning ("Gitlab URL not provided, falling back to gitlab.com" )
113+ cfg .URL = "gitlab.com"
114114 cfg .Host = "gitlab.com"
115115 }
116116
@@ -132,9 +132,9 @@ func (cfg *cloneConfig) setSourceDir() {
132132 os .MkdirAll (cfg .SourceDir , 0755 )
133133}
134134
135- func (cfg * cloneConfig ) setUrl () {
136- if ! isFullURL (cfg .Url ) {
137- cfg .Url = fmt .Sprintf ("git@%s:%s/%s" , cfg .Url , cfg .User , cfg .Repo )
135+ func (cfg * cloneConfig ) setURL () {
136+ if ! isFullURL (cfg .URL ) {
137+ cfg .URL = fmt .Sprintf ("git@%s:%s/%s" , cfg .URL , cfg .User , cfg .Repo )
138138 }
139139}
140140
@@ -146,9 +146,9 @@ func (cfg *cloneConfig) clone() {
146146 session := shell .Session ()
147147 session .SetDir (cfg .SourceDir )
148148
149- err := session .Command ("git" , "clone" , cfg .Url ).PrintOutput ()
149+ err := session .Command ("git" , "clone" , cfg .URL ).PrintOutput ()
150150 if err != nil {
151- printer .Fail ("Failed to clone %s" , cfg .Url )
151+ printer .Fail ("Failed to clone %s" , cfg .URL )
152152 return
153153 }
154154 printer .Success ("Clone was successful" )
0 commit comments