Permalink
Browse files

Add -v/--version and -h (short for --help) to bin/redcarpet

  • Loading branch information...
ahti committed Sep 14, 2013
1 parent e8e2546 commit b8b1b140ca000cd3c3782bfba5379d7e99f2b8c5
Showing with 8 additions and 3 deletions.
  1. +8 −3 bin/redcarpet
View
@@ -4,18 +4,23 @@
# no <file> or when <file> is '-', read Markdown source text from standard input.
# With <extension>s, perform additional Markdown processing before writing output.
# With --smarty, use the SmartyHTML renderer
-if ARGV.include?('--help')
+if ARGV.include?('--help') or ARGV.include?('-h')
File.read(__FILE__).split("\n").grep(/^# /).each do |line|
puts line[2..-1]
end
exit 0
end
+require 'redcarpet'
+
+if ARGV.include?('--version') or ARGV.include?('-v')
+ puts "Redcarpet #{Redcarpet::VERSION}"
+ exit 0
+end
+
root = File.expand_path('../../', __FILE__)
$:.unshift File.expand_path('lib', root)
-require 'redcarpet'
-
render_extensions = {}
parse_extensions = {}
renderer = Redcarpet::Render::HTML

0 comments on commit b8b1b14

Please sign in to comment.