Skip to content

Commit

Permalink
Improved help message for bin/rpeg-multimarkdown
Browse files Browse the repository at this point in the history
  • Loading branch information
oawhyte committed Jun 8, 2011
1 parent 66e516b commit cc4fe8e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/rpeg-multimarkdown
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class Parser
@used_short << short = o[2][:short] || short_from(o[0])
@result[o[0]] = o[2][:default] || false # set default
klass = o[2][:default].class == Fixnum ? Integer : o[2][:default].class

desk = o[1] + (o[2][:nodefault] ? "" : " (default is #{@result[o[0]]})")
if [TrueClass, FalseClass, NilClass].include?(klass) # boolean switch
p.on("-" << short, "--[no-]" << o[0].to_s.gsub("_", "-"), o[1]) {|x| @result[o[0]] = x}
p.on("-" << short, "--[no-]" << o[0].to_s.gsub("_", "-"), desk) {|x| @result[o[0]] = x}
else # argument with parameter
p.on("-" << short, "--" << o[0].to_s.gsub("_", "-") << " " << o[2][:default].to_s, klass, o[1]) {|x| @result[o[0]] = x}
p.on("-" << short, "--" << o[0].to_s.gsub("_", "-") << " " << (o[2][:name] ? "[#{o[2][:name].to_s}]" : ""), klass, desk) {|x| @result[o[0]] = x}
end
end

Expand All @@ -86,14 +86,14 @@ options = Parser.new do |p|
p.banner = "Ruby interface to MultiMarkdown"
p.version = "rpeg-multimarkdown 0.1.0"
p.option :compatibility, "markdown compatibility mode", :default => false
p.option :filter_html, "filter out raw HTML (except styles)", :default => false
p.option :filter_html, "filter out raw HTML except styles", :default => false
p.option :process_html, "process MultiMarkdown inside of raw HTML", :default => false
p.option :filter_styles, "filter out HTML styles", :default => false
p.option :smart, "use smart typography extension", :default => true
p.option :notes, "use notes extension", :default => true
p.option :output, "send output to FILE (default is stdout)", :default => ""
p.option :to, "convert to FORMAT (default is html)", :default => "html", :value_in_set => ["html","latex","memoir","beamer","odf","opml"]
p.option :extract, "extract and display specified metadata", :default => ""
p.option :output, "send output to FILE (default is stdout)", :name => "FILE", :default => "", :nodefault => true
p.option :to, "convert to FORMAT", :name => "FORMAT", :default => "html", :value_in_set => ["html","latex","memoir","beamer","odf","opml"]
p.option :extract, "extract and display metadata specified by KEY", :name => "KEY", :default => "", :nodefault => true
end.process!

# Convert options to MultiMarkdown module's options
Expand Down

0 comments on commit cc4fe8e

Please sign in to comment.