Permalink
Browse files

Improved help message for bin/rpeg-multimarkdown

  • Loading branch information...
1 parent 66e516b commit cc4fe8ef64ece41cf2ed4132d83c540c7e9414eb @djungelvral committed Jun 8, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 bin/rpeg-multimarkdown
View
14 bin/rpeg-multimarkdown
@@ -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
@@ -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

0 comments on commit cc4fe8e

Please sign in to comment.