Source

bitbucket-backup / bin / bitbucket-backup

#!/usr/bin/env ruby

require "highline/import"
require "bitbucket-backup"
require "optparse"

options = {}
options[:all_repos] = false

parser = OptionParser.new do | opts |

  opts.banner = "Usage: #{$0} [options] /path/to/backupdir\nUsername and password are required."

  # Backup all repos visible to user
  opts.on("-a", "--all-repos", "Backup all visible repos to user") do
    options[:all_repos] = true
  end

  # Required: Username
  opts.on("-u", "--username USERNAME", "Required: Username for account to be backed up") do | username |
    options[:username] = username
  end

  # Required: Password
  opts.on("-p", "--password PASSWORD", "Required: Password for account to be backed up") do | password |
    options[:password] = password
  end

end
parser.parse!

if ARGV.empty? || !options[:password] || !options[:username]
    puts parser.banner
    exit
end


Bitbucket::Backup.run(options[:username], options[:password], ARGV.first, options[:all_repos])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.