class Redcarpet::CLI
def self.options_parser
def self.options_parser @@options = { render_extensions: {}, parse_extensions: {}, smarty_pants: false } OptionParser.new do |opts| opts.banner = "Usage: redcarpet [--parse <extension>...] " \ "[--render <extension>...] [--smarty] <file>..." opts.on("--parse EXTENSION", "Enable a parsing extension") do |ext| ext = ext.gsub('-', '_').to_sym @@options[:parse_extensions][ext] = true end opts.on("--render EXTENSION", "Enable a rendering extension") do |ext| ext = ext.gsub('-', '_').to_sym @@options[:render_extensions][ext] = true end opts.on("--smarty", "Enable Smarty Pants") do @@options[:smarty_pants] = true end opts.on_tail("-v", "--version", "Display the current version") do STDOUT.puts "Redcarpet #{Redcarpet::VERSION}" exit end opts.on_tail("-h", "--help", "Display this help message") do puts opts exit end end end