Permalink
Browse files

Added mandy-ls

  • Loading branch information...
1 parent 3f6e4c8 commit 7db66fe0bf0d959e0bb8e6a0828a89bd9e985083 @horaci horaci committed Jan 20, 2012
Showing with 33 additions and 0 deletions.
  1. +33 −0 bin/mandy-ls
View
33 bin/mandy-ls
@@ -0,0 +1,33 @@
+#!/usr/bin/env ruby
+require 'optparse'
+require 'ostruct'
+
+require "rubygems"
+require "mandy"
+
+
+HadoopConfiguration.check_home_and_version
+
+exec('mandy-ls -h') if ARGV.size == 0
+
+options = OpenStruct.new
+
+OptionParser.new do |opts|
+ opts.banner = "USAGE: mandy-ls file_or_directory"
+
+ 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!
+
+file = ARGV[0]
+config = options.config || 'cluster.xml'
+
+
+list = system("$HADOOP_HOME/bin/hadoop fs -conf #{config} -ls #{file}")
+puts list

0 comments on commit 7db66fe

Please sign in to comment.