add --auto option

This commit is contained in:
Tom Preston-Werner 2008-12-06 14:53:03 -08:00
parent 5b0ce6dddc
commit 3f8b9a08fa
1 changed files with 21 additions and 9 deletions

View File

@ -2,8 +2,28 @@
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib]) $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
require 'optparse'
require 'jekyll' require 'jekyll'
opts = OptionParser.new do |opts|
opts.banner = <<-EOF
Jekyll is a blog-aware, static site generator.
Basic Command Line Usage:
jekyll # . -> ./_site
jekyll <path to write generated site> # . -> <path>
jekyll <path to source> <path to write generated site> # <path> -> <path>
Options:
EOF
opts.on("--auto", "Auto-regenerate") do
options[:auto] = true
end
end
opts.parse!
case ARGV.size case ARGV.size
when 0 when 0
dest = File.join('.', '_site') dest = File.join('.', '_site')
@ -16,12 +36,4 @@ case ARGV.size
Jekyll.process(ARGV[0], ARGV[1]) Jekyll.process(ARGV[0], ARGV[1])
else else
puts DATA.read puts DATA.read
end end
__END__
Jekyll is a blog-aware, static site generator.
Basic Command Line Usage:
jekyll # . -> ./_site
jekyll <path to write generated site> # . -> <path>
jekyll <path to source> <path to write generated site> # <path> -> <path>