android.moparisthebest.org/octopress/bin/octopress
2011-12-21 12:38:38 -05:00

58 lines
1.2 KiB
Ruby
Executable File

#!/usr/bin/env ruby
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
require 'rubygems'
require 'gli'
require 'octopress'
include GLI
program_desc 'A blogging framework for hackers.'
version Octopress::VERSION
desc 'Describe some switch here'
switch [:s,:switch]
desc 'Describe some flag here'
default_value 'the default'
arg_name 'The name of the argument'
flag [:f,:flagname]
desc 'Describe create here'
arg_name 'Describe arguments to create here'
command :create do |c|
c.desc 'Describe a switch to create'
c.switch :s
c.desc 'Describe a flag to create'
c.default_value 'default'
c.flag :f
c.action do |global_options,options,args|
Octopress::Commands::Create.new(args[0] || '.').execute
end
end
pre do |global,command,options,args|
# Pre logic here
# Return true to proceed; false to abourt and not call the
# chosen command
# Use skips_pre before a command to skip this block
# on that command only
true
end
post do |global,command,options,args|
# Post logic here
# Use skips_post before a command to skip this
# block on that command only
end
on_error do |exception|
# Error logic here
# return false to skip default error handling
true
end
exit GLI.run(ARGV)