Sha256: f93ad7304ee158ad6bef9405c195dad282b089f90b76b6d618df6c1d0f2f0630

Contents?: true

Size: 1006 Bytes

Versions: 2

Compression:

Stored size: 1006 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'pathname'

$: << File.expand_path('../../lib', Pathname.new(__FILE__).realpath)

require 'junoser/cli'


command = nil
opts = OptionParser.new do |opts|
  opts.banner = 'junoser: an juniper configuration parser'
  opts.define_head 'Usage: junoser [options] [path]'
  opts.separator ''
  opts.separator 'Options:'

  opts.on '-c', '--check', 'Verify syntax' do
    command = :check
  end

  opts.on '-d', '--display-set', 'Translate to "display set" form' do
    command = :display_set
  end

  opts.on '-s', '--structured', 'Translate to structured form' do
    command = :struct
  end

  opts.on_tail '-h', '--help', 'Show this message' do
    puts opts
    exit
  end

  opts.on_tail '-v', '--version', 'Show version' do
    puts Junoser::VERSION
  end
end
opts.parse!

case command
when :check
  abort unless Junoser::Cli.commit_check($<)
when :display_set
  Junoser::Cli.display_set $<
when :struct
  Junoser::Cli.struct $<
else
  puts opts
  abort
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
junoser-0.1.2 exe/junoser
junoser-0.1.1 exe/junoser