bin/mdoc in mdoc-0.0.3 vs bin/mdoc in mdoc-0.0.5

- old
+ new

@@ -1,32 +1,11 @@ -#!/usr/bin/env ruby -# vim: ft=ruby - -$: << 'lib' # debug only - -require "mdoc" -require "optparse" - -options = {} - -optparse = OptionParser.new do |opts| - opts.banner = "Usage: mdoc [options] filename.md" - opts.separator "Options:" - - options[:type] = 'odt' - opts.on('-t TYPE', '--type TYPE', 'output file type') do |type| - options[:type] = type - end - - opts.on_tail('-h', '--help', 'Display this screen') do - puts opts - exit - end -end - -optparse.parse!(ARGV) - -file = ARGV[0] -raise "Only markdown file (`*.md`) can be parsed" unless file =~ /\.md$/ - -klass = options[:type].to_s.capitalize -eval("Mdoc::" + klass).new(file).convert +#!/usr/bin/env ruby +# encoding: utf-8 +# vi: ft=ruby + +# $LOAD_PATH.unshift 'lib' # debug only +require 'mdoc' + +Mdoc.load_conf_files %w[/etc/mdoc.conf ~/.mdoc.conf] +Mdoc.load_cli_options ARGV + +Mdoc.execute!