12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/sheetsy/cli.rb', line 12
def convert
source = if options[:source]
options[:source]
elsif ENV.key?("SOURCE")
ENV.fetch("SOURCE")
else
get_input("Source Directory", Dir.pwd)
end
destination = if options[:destination]
options[:destination]
elsif ENV.key?("DESTINATION")
ENV.fetch("DESTINATION")
else
default_source_folders = source.split("/")
default_output_folder = "#{default_source_folders.pop}_json"
get_input("Output Directory", File.join(*default_source_folders, default_output_folder))
end
Sheetsy::Converter.new(source, destination, options).run
end
|