Sha256: 1d56b6e15be9f6122e1fbe414301b5db66c6e23f52e5868acadcbc36a200f339

Contents?: true

Size: 773 Bytes

Versions: 9

Compression:

Stored size: 773 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH << File.expand_path("../../lib", __FILE__)

require 'hieracles'

opt = Hieracles::Optparse.new(ARGV)

if opt.options.has_key? :version
  puts Hieracles.version
  exit(0)
end

fqdn = opt.payload[0]
command = opt.payload[1]
args = opt.payload[2..-1]

unless fqdn && command
  puts Hieracles::Help.usage
  exit(1)
end
 
if Hieracles::Format.method_defined? command
  node = Hieracles::Node.new fqdn, opt.options
  begin
    formatter = Object.const_get("Hieracles::Formats::#{Hieracles::Config.format}")
  rescue
    puts "  Unknown format #{Hieracles::Config.format}"
    exit(1)
  end
  dispatch = formatter.new node
  puts dispatch.send(command.to_sym, args)
else
  puts "  Unknown command: #{command}"
  Hieracles::Help.usage
  exit(1)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hieracles-0.2.0 bin/hc
hieracles-0.1.7 bin/hc
hieracles-0.1.6 bin/hc
hieracles-0.1.5 bin/hc
hieracles-0.1.4 bin/hc
hieracles-0.1.3 bin/hc
hieracles-0.1.2 bin/hc
hieracles-0.1.1 bin/hc
hieracles-0.1.0 bin/hc