Sha256: cc764026f0288a3e28ae995fa42aabba3260c5c5e1db46be428167fa083dad47

Contents?: true

Size: 709 Bytes

Versions: 1

Compression:

Stored size: 709 Bytes

Contents

#!/usr/bin/env ruby

require 'rmega'
require 'rmega/cli'

include Rmega::CLI::Helpers

if ARGV.empty?
  ARGV << '--help'
else
  cli_options[:path] = ARGV[0]
end

OptionParser.new do |opts|
  opts.banner = "Usage:\n"
  opts.banner << "\t#{File.basename(__FILE__)} path [options]\n"
  opts.banner << "Options:"

  apply_opt_parser_options(opts)
end.parse!

rescue_errors_and_inerrupt do
  raise("File not found - #{cli_options[:path]}") unless File.exists?(cli_options[:path])

  user = cli_options[:user] || raise("User email is required")
  pass = cli_options[:pass] ||= cli_prompt_password

  session = Rmega::Session.new.login(user, pass)
  root = session.storage.root
  root.upload(cli_options[:path])
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rmega-0.2.0 bin/rmega-up