Sha256: d624b773285344f9c3dc5a00bb9cb149a92d76486b51d15bce0ef658282b4dd3

Contents?: true

Size: 961 Bytes

Versions: 3

Compression:

Stored size: 961 Bytes

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'rubygems'
require 'ganapati'

VERBOSE_PROPS = [:path, :length, :isdir, :modification_time, :permission, :owner, :group]

options = { :verbose => false, :recursive => false }
op = OptionParser.new { |opts|
  opts.banner = "Usage: hls [options] host:port/location"

  opts.on('-h', '--help', 'displays usage information') { 
    puts opts
    exit
  }

  opts.on('-r', '--recursive', 'copy recursively') {
    options[:recursive] = true
  }

  opts.on('-v', '--verbose', 'verbose output') {
    puts VERBOSE_PROPS.map { |a| a.to_s }.join("\t")
    options[:verbose] = true
  }
}
op.parse!

if ARGV.length != 1
  puts op.to_s
  exit 1
end

url = Ganapati::FileUrl.new ARGV.first
client = Ganapati::Client.new url.host, url.port
client.ls(url.path, options[:verbose], options[:recursive]).each { |s|
  if options[:verbose]
    puts VERBOSE_PROPS.map { |p| s.send p }.join("\t")
  else
    puts s
  end
}
client.close

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ganapati-0.0.7 bin/hls
ganapati-0.0.6 bin/hls
ganapati-0.0.5 bin/hls