31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/zendesk/command_line.rb', line 31
def run
opts = Slop.parse do |opts|
opts.array '-f', '--files', '"path/to/file.json"', default: default_file_paths
opts.string '-c', '--command', '"<FIELD>=<VALUE>"', required: true
opts.string '-s', '--strategy', '"ruby", "sqlite3" supported', default: 'ruby'
opts.string '-p', '--printer', '"table", "json" supported', default: 'table'
opts.on '-h', '--help' do
puts opts
puts HELP_TEXT
exit
end
opts.on '--version', 'print the version' do
puts Zendesk::VERSION
exit
end
end
results = Zendesk::Processor.process(opts[:command], opts[:files], opts[:strategy])
Zendesk::Printer.get(opts[:printer]).print(results)
rescue Exception => e
puts e.message
exit
end
|