Sha256: 2a8d2c7c8a4eed875046e5934d83615e75f40aba7d3558c2fa2c563dc10e0fef
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
#!/usr/bin/env ruby $:.unshift(File.dirname(__FILE__) + '/../lib') require 'oct' require 'optparse' require 'term/ansicolor' available_actions = Oct::AVAILABLE_ACTIONS banner = <<BANNER Octal file listing Usage: oct [options] [FILES] BANNER banner << "\nActions: #{available_actions.join(' ')}\n" unless available_actions.empty? help = banner help += <<HELP Options: HELP options = {} OptionParser.new do |opts| opts.banner = help # set defaults options[:verbose] = false options[:coloring] = true opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| options[:verbose] = v end opts.on("-c", "--[no-]coloring", "Ansi color in output") do |c| options[:coloring] = c end opts.on("--version", "Display current version") do puts "oct, version " + Oct.version exit 0 end # opts.on("--config FILE", "Load configuration options from FILE") do |file| # options[:config] = file # end # no argument, shows at tail. This will print an options summary. opts.on_tail("-h", "--help", "Show this message") do puts opts exit 0 end begin opts.parse! rescue OptionParser::InvalidOption => e puts "oct #{e}" puts "oct --help for more information" exit 1 end end if STDOUT.isatty Term::ANSIColor::coloring = options[:coloring] else Term::ANSIColor::coloring = false end app = Oct::App.new(FileUtils.pwd, options) app.run
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oct-0.1.0 | bin/oct |