lib/megar/shell.rb
# Command: execute the megar task according to the options provided on initialisation
execute the megar task according to the options provided on initialisation
execute the megar task according to the options provided on initialisation
def run
    if email && password
      $stderr.puts "Connecting to mega as #{email}.."
      raise "Failed to connect!" unless session.connected?
      case args.first
      when /ls/i
        ls
      when /get/i
        get(args[1])
      when /put/i
        put(args.drop(1))
      else
        $stderr.puts "Connected!"
      end
    else
      usage
    end
  end
def run if email && password $stderr . puts "Connecting to mega as #{email}.." raise "Failed to connect!" unless session . connected? case args . first when / ls /i ls when / get /i get ( args [ 1 ] ) when / put /i put ( args . drop ( 1 ) ) else $stderr . puts "Connected!" end else usage end end
Command: execute the megar task according to the options provided on initialisation
Command : execute the megar task according to the options provided on initialisation