Skip to content

Instantly share code, notes, and snippets.

@syou6162
Created September 8, 2012 04:48
Show Gist options
  • Save syou6162/3671898 to your computer and use it in GitHub Desktop.
Save syou6162/3671898 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require "optparse"
@options = {
:hatena => nil, #はてなで開く
}
opts = OptionParser.new
opts.on("--hatena"){|boolean|
@options[:hatena] = boolean
}
opts.parse!(ARGV)
if @options[:hatena]
system "open http://d.hatena.ne.jp/syou6162/#{ARGV[0]}"
else
year = ARGV[0][0..3]
month = ARGV[0][4..5]
day = ARGV[0][6..7]
system "ruby ~/bin/convert_from_hatena_to_html.rb -i ~/hatena/syou6162/diary/#{year}-#{month}-#{day}.txt -o /tmp/#{ARGV[0]}.html"
system "open /tmp/#{ARGV[0]}.html"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment