Sha256: 48d08f5d4713d052389ef9ae1fe79fc98ffefe48bd6dc6f7b145ea5c88e5d755

Contents?: true

Size: 700 Bytes

Versions: 6

Compression:

Stored size: 700 Bytes

Contents

#!/usr/bin/env ruby

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

require 'hieracles'

opt = Hieracles::Optparse.new(ARGV)

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

6 entries across 6 versions & 1 rubygems

Version Path
hieracles-0.0.6 bin/hc
hieracles-0.0.5 bin/hc
hieracles-0.0.4 bin/hc
hieracles-0.0.3 bin/hc
hieracles-0.0.2 bin/hc
hieracles-0.0.1 bin/hc