Created
May 8, 2009 00:08
-
-
Save jashmenn/108487 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'git-style-binary/command' | |
GitStyleBinary.command do | |
short_desc "create a blog post" | |
banner <<-EOS | |
Usage: #{command.full_name} #{all_options_string} {content|STDIN} | |
Posts content to a wordpress blog | |
EOS | |
opt :blog, "short name of the blog to use", :default => 'default' | |
opt :category, "tag/category. specify multiple times for multiple categories", :type => String, :multi => true | |
opt :title, "title for the post", :required => true, :type => String | |
opt :type, "type of the content [html|xhtml|text]", :default => 'html', :type => String | |
run do |command| | |
command.die :type, "type must be one of [html|xhtml|text]" unless command.opts[:type] =~ /^(x?html|text)$/i | |
puts "Subcommand name: #{command.name.inspect}" | |
puts "Options: #{command.opts.inspect}" | |
puts "Remaining arguments: #{command.argv.inspect}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment