lib/github_cloner/opt_parser.rb in github-cloner-0.4.0 vs lib/github_cloner/opt_parser.rb in github-cloner-0.5.0

- old
+ new

@@ -8,10 +8,11 @@ # The options specified on the command line will be collected in *options*. options = OpenStruct.new # Set the sensible default for the options explicitly options.base_dir = "." + options.repo_host = "github.com" options.all_repos = false options.group_by_user = false options.clone_repos = false options.languages = [] @@ -49,10 +50,16 @@ Array, "Clone all repos that in the list of languages") do |langs| options.languages = langs end + opts.on("-r", "--repo-host REPO_HOST", + "where REPO_HOST is the repository host to be cloned from", + "If not specified, github.com will be used") do |host| + options.repo_host = host + end + # Boolean switch. opts.on("-a", "--[no-]all-repos", "All repository only (optional)", "default to original/non-forked repositories only") do |all_repos| options.all_repos = all_repos @@ -92,18 +99,23 @@ puts "$github-cloner -b ~/Desktop/projects -u awesome_user -l 'JavaScript,Emacs Lisp' -c" puts "" puts "5) Clone all 'JavaScript' and 'Emacs Lisp' repositories for a given organization where a given user belongs to (include private repos)" puts "$github-cloner -b ~/Desktop/projects -u awesome_user -o awesome_company -l -t GITHUB_TOKEN -l 'JavaScript,Emacs Lisp' -c" puts "" + puts "6) Clone all 'JavaScript' and 'Emacs Lisp' repositories for a given organization where a given user belongs to (include private repos)" + puts " Using the host configured in ~/.ssh/config file instead of the default github.com" + puts "$github-cloner -b ~/Desktop/projects -u awesome_user -o awesome_company -l -t GITHUB_TOKEN -l 'JavaScript,Emacs Lisp' -r github-work -c" + puts "" exit end end opt_parser.parse!(args) options end end end +## NOTE: for testing only # options = GithubCloner::OptParser.parse(ARGV) # puts options # puts ARGV