Sha256: 57dc522f06729f26683f9de5652e0609b1195fc5200f73c14dad9457a5f9f03b

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

#!/usr/bin/env ruby

require 'ripper_tree'
require 'optparse'

options = { color: true, space_size: 8 }

OptionParser.new do |opt|
  opt.banner = 'Usage: rtree [options] programfile'
  opt.on('-e `command`', 'one line of script.') { |code| options[:code] = code }
  opt.on('-s `space size`', 'set space size [default size is 8].') { |size| options[:space_size] = size.to_i }
  opt.on('-v', '--version', 'display the version.') { options[:version] = true }
  opt.on('-c', '--[no-]color', 'color option') { options[:color] = false }

  opt.parse!(ARGV)
end

RipperTree::OPTIONS.merge!(options)

case
  when options[:code]
    puts RipperTree.create(options[:code])
  when options[:version]
    puts "RipperTree version: #{RipperTree::VERSION}"
  else
    puts RipperTree.create(File.read(ARGV.first, encoding: 'utf-8'))
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ripper_tree-0.1.3 exe/rtree