lib/rouge/cli.rb in rouge-1.1.0 vs lib/rouge/cli.rb in rouge-1.2.0
- old
+ new
@@ -40,10 +40,11 @@
yield %|where <command> is one of:|
yield %| highlight #{Highlight.desc}|
yield %| help #{Help.desc}|
yield %| style #{Style.desc}|
yield %| list #{List.desc}|
+ yield %| version #{Version.desc}|
yield %||
yield %|See `rougify help <command>` for more info.|
end
class Error < StandardError
@@ -78,17 +79,31 @@
raise Error.new(msg, status)
end
def self.class_from_arg(arg)
case arg
+ when 'version', '--version'
+ Version
when 'help'
Help
when 'highlight', 'hi'
Highlight
when 'style'
Style
when 'list'
List
+ end
+ end
+
+ class Version < CLI
+ def self.desc
+ "print the rouge version number"
+ end
+
+ def self.parse(*); new; end
+
+ def run
+ puts Rouge.version
end
end
class Help < CLI
def self.desc