@@ -11,8 +11,14 @@ import (
1111var app = cli .New (version , "clone a repo into a common path" , get )
1212
1313func init () {
14- app .DefineBoolFlag ("force" , false , "overwrite existing directory" )
14+ app .DefineStringFlag ("host" , "github.com" , "define the host for path based queries." )
15+ app .DefineBoolFlag ("force" , false , "overwrite existing directory." )
16+ app .DefineBoolFlag ("ssh" , false , "use ssh for the connection." )
17+ app .DefineBoolFlag ("bitbucket" , false , "lookup with bitbucket." )
18+ app .DefineBoolFlag ("github" , false , "lookup with github." )
1519 app .AliasFlag ('f' , "force" )
20+ app .AliasFlag ('h' , "host" )
21+ app .AliasFlag ('S' , "ssh" )
1622 app .DefineParams ("url" )
1723}
1824
@@ -26,7 +32,15 @@ func get(c cli.Command) {
2632 }
2733
2834 // Vars
29- repoURL := parseURL (c .Param ("url" ).String ())
35+ var host string
36+ if (c .Flag ("bitbucket" ).Get () == true ) {
37+ host = "bitbucket.org"
38+ } else if (c .Flag ("github" ).Get () == true ){
39+ host = "github.com"
40+ } else {
41+ host = c .Flag ("host" ).String ()
42+ }
43+ repoURL := parseURL (c .Param ("url" ).String (), host , c .Flag ("ssh" ).Get () == true )
3044 clonePath := parsePath (repoURL )
3145 cloneOpts := cloneOptionsForURL (repoURL )
3246
@@ -36,7 +50,7 @@ func get(c cli.Command) {
3650 }
3751
3852 // Clone
39- fmt .Printf ("Cloning into '%s'...\n " , clonePath )
53+ fmt .Printf ("Cloning '%s' into '%s'...\n " , repoURL , clonePath )
4054 _ , err := git .Clone (repoURL .String (), clonePath , cloneOpts )
4155 exitIfErr (err )
4256 fmt .Println ("\n Done!" )
0 commit comments