Sha256: 492485167e719d3bffeacd554bcc22ed90f5ddbe6fc70cb0cd11184695bf1a20

Contents?: true

Size: 657 Bytes

Versions: 25

Compression:

Stored size: 657 Bytes

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'

exec('mandy-cat -h') unless ARGV.size >= 2

options = OpenStruct.new

OptionParser.new do |opts|
  opts.banner = "USAGE: mandy-cat hdfs_path [options]"

  opts.on("-c", "--conf HADOOP_CONF", "Use this cluster xml config file.") do |config|
    options.config = config
  end
  
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
end.parse!


def absolute_path(path)
  path =~ /^\// ? path : File.join(Dir.pwd, path)
end

hdfs_path = ARGV[0]
config = absolute_path(options.config || 'cluster.xml')

exec("$HADOOP_HOME/bin/hadoop fs -conf #{config} -cat #{hdfs_path}")

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mandy-0.4.94 bin/mandy-cat
mandy-0.4.93 bin/mandy-cat
mandy-0.4.92 bin/mandy-cat
mandy-0.4.91 bin/mandy-cat
mandy-0.4.90 bin/mandy-cat