Created
December 26, 2015 17:46
-
-
Save daiiz/41936ee5c7ffb1914eba to your computer and use it in GitHub Desktop.
This file contains 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
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