module Tagger class CLI < Thor desc "generate", "an AnlayticsEvent file" option :platform, required: true option :out, required: true def generate(url) puts "Generate AnalyticsEvent.#{options[:platform] == 'ios' ? 'swift' : 'kotlin'}" # Download as CSV downloader = Tagger::Downloader.new(url) csv = downloader.download() # Parse CSV raw_file = CSV.parse(csv, headers: true) events = raw_file.map do |row| event_name = row[1] if event_name.nil? nil else Tagger::Event.new(event_name) end end.compact generator = Tagger::Generator.new(events, options[:platform].to_sym) generator.generate(options[:out]) end end end