Permalink
Browse files

Use OptionParser's [no-] functionality for better boolean parsing.

  • Loading branch information...
1 parent 31901ee commit 65622cb1e0d023502a32da572be11bf7090015b3 @mojombo mojombo committed Dec 14, 2010
Showing with 14 additions and 18 deletions.
  1. +4 −0 History.txt
  2. +10 −18 bin/jekyll
View
@@ -1,3 +1,7 @@
+== HEAD
+ * Minor Enhancements
+ * Use OptionParser's [no-] functionality for better boolean parsing.
+
== 0.8.0 / 2010-11-22
* Minor Enhancements
* Add wordpress.com importer (#207)
View
@@ -23,16 +23,12 @@ options = {}
opts = OptionParser.new do |opts|
opts.banner = help
- opts.on("--safe", "Safe mode (default unsafe)") do
- options['safe'] = true
+ opts.on("--[no-]safe", "Safe mode (default unsafe)") do |safe|
+ options['safe'] = safe
end
- opts.on("--auto", "Auto-regenerate") do
- options['auto'] = true
- end
-
- opts.on("--no-auto", "No auto-regenerate") do
- options['auto'] = false
+ opts.on("--[no-]auto", "Auto-regenerate") do |auto|
+ options['auto'] = auto
end
opts.on("--server [PORT]", "Start web server (default port 4000)") do |port|
@@ -44,12 +40,12 @@ opts = OptionParser.new do |opts|
options['baseurl'] = baseurl
end
- opts.on("--lsi", "Use LSI for better related posts") do
- options['lsi'] = true
+ opts.on("--[no-]lsi", "Use LSI for better related posts") do |lsi|
+ options['lsi'] = lsi
end
- opts.on("--pygments", "Use pygments to highlight code") do
- options['pygments'] = true
+ opts.on("--[no-]pygments", "Use pygments to highlight code") do |pygments|
+ options['pygments'] = pygments
end
opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
@@ -64,12 +60,8 @@ opts = OptionParser.new do |opts|
options['time'] = Time.parse(time)
end
- opts.on("--future", "Render future dated posts") do
- options['future'] = true
- end
-
- opts.on("--no-future", "Do not render future dated posts") do
- options['future'] = false
+ opts.on("--[no-]future", "Render future dated posts") do |future|
+ options['future'] = future
end
opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|

0 comments on commit 65622cb

Please sign in to comment.