Skip to content

Instantly share code, notes, and snippets.

@masui masui/gyazo.rb
Created Dec 28, 2015

Embed
What would you like to do?
gyazoコマンド
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
#
require 'shellwords'
if ARGV.length == 0
STDERR.puts "% gyazo query"
STDERR.puts "% gyazo -f uploadfile1 uploadfile2"
exit
end
if ARGV[0] == '-f' then
ARGV.shift
script = "/Applications/Gyazo.app/Contents/Resources/script"
args = ARGV.map { |arg|
Shellwords.escape arg
}
system "/usr/bin/ruby #{script} #{script} #{args.join(' ')}"
else
query = ARGV.join(" ")
url = Shellwords.escape("http://Gyazo.com/search/#{query}")
system "open #{url}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.