Skip to content

Instantly share code, notes, and snippets.

@daiiz
Created December 26, 2015 17:46
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 daiiz/41936ee5c7ffb1914eba to your computer and use it in GitHub Desktop.
Save daiiz/41936ee5c7ffb1914eba to your computer and use it in GitHub Desktop.
require 'json'
# Google Apps Script を「ウェブアプリケーションとして導入」した際に発行されたURL
appUrl = 'https://script.google.com/macros/...../exec'
num = '?num='
uri = '?uri='
mode = ARGV[0]
value = ARGV[1]
if (mode == '-u' and value != nil)
# URIを新規登録する
appUrl = appUrl + uri + value
json = `curl -sL '#{appUrl}'`
puts JSON.parse(json)['num'] || ''
elsif (mode == '-n' and value != nil)
# 与えられた行番号に保存されているURIを取得する
appUrl = appUrl + num + value
json = `curl -sL '#{appUrl}'`
puts JSON.parse(json)['uri'] || ''
else
exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment