Skip to content

Instantly share code, notes, and snippets.

@masui
Created December 28, 2015 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masui/e7d2e879238beaef2061 to your computer and use it in GitHub Desktop.
Save masui/e7d2e879238beaef2061 to your computer and use it in GitHub Desktop.
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