97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/gspush.rb', line 97
def self.parse_option(argv_original)
options = {}
opt = OptionParser.new
opt.on('-d delim', 'input delimiter') {|v| options[:delimiter] = v }
opt.on('-u username', 'Google Drive username(email)') {|v| options[:username] = v }
opt.on('-p password', 'user password') {|v| options[:password] = v } opt.on('-o', 'using oauth2 authorize') {|v| options[:oauth2] = v }
opt.on('-f oauth_token_file', 'oauth2 token file path') {|v| options[:oauth_token_file] = v }
opt.on('-s sheet_title', 'worksheet title (default: first worksheet)') {|v| options[:sheet_title] = v }
opt.on('-t', 'prepend timestamp cell') {|v| options[:prepend_timestamp] = v }
opt.banner = "Usage: gspush URL [options]"
opt.version = Gspush::VERSION
argv = opt.parse(argv_original)
if argv.empty? && !options[:generate_token_file]
puts opt.banner
exit 1
end
[argv, options]
end
|