Sha256: 0e9f686c8aae8d0510264c81193e5510919e905139da22daf222024e27fbbbe8

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'mite-backup'
require 'optparse'

@options = {}

parser = OptionParser.new do |opts|
  opts.banner = "Usage: mite-backup COMMAND [options]"

  opts.separator ""
  opts.separator "Options:"

  opts.on("-a", "--account [ACCOUNT]", "your mite account-name (subdomain without .mite.yo.lk)") do |account|
    @options["account"] = account
  end

  opts.on("-e", "--email [EMAIL]", "mite.user email") do |email|
    @options["email"] = email
  end

  opts.on("-p", "--password [PASSWORD]", "mite.user password") do |password|
    @options["password"] = password
  end

  opts.on("-c", "--clear", "Removes all config values from config file.") do
    @options["clear_config"] = true
  end

  opts.on("-h", "--help", "Show this message") do
    puts opts
    exit
  end

  opts.separator ""
  opts.separator "Commands:"
  opts.separator "  get     Download backupfile and ouput xml to STDOUT (Default command)"
  opts.separator "  setup    Write given options to config file ~/.mite-backup.yml, so you don't need to repeat the on ever get command."
  opts.separator ""
end

parser.parse!

case ARGV[0] || "get"
when 'get'
  MiteBackup.new(@options).run
when 'setup'
  MiteBackup.new(@options).setup
else
  $stderr.puts "Unknown command #{ARGV[0].inspect}"
  puts ""
  puts parser.help
  exit(1)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mite-backup-0.1.2 bin/mite-backup
mite-backup-0.1.1 bin/mite-backup
mite-backup-0.1.0 bin/mite-backup
mite-backup-0.0.2 bin/mite-backup