Class: Kamome::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/kamome/cli.rb

Instance Method Summary collapse

Instance Method Details

#generate_csv(filepath) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/kamome/cli.rb', line 11

def generate_csv(filepath)
  path = ::Pathname.new(filepath)
  do_generate_csv(operation_all, path, options[:header])
  $stdout.puts "Generated csv: #{path}"
rescue StandardError => e
  path.delete if path&.exist?
  raise e
end

#generate_diff_csv(filepath) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/kamome/cli.rb', line 23

def generate_diff_csv(filepath)
  path = ::Pathname.new(filepath)
  do_generate_csv(operation_diff(options[:date]), path, options[:header])
  $stdout.puts "Generated diff csv: #{path}"
rescue StandardError => e
  path.delete if path&.exist?
  raise e
end

#generate_diff_json(filepath) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/kamome/cli.rb', line 41

def generate_diff_json(filepath)
  path = ::Pathname.new(filepath)
  do_generate_json(operation_diff(options[:date]), path)
  $stdout.puts "Generated diff json: #{path}"
rescue StandardError => e
  path.delete if path&.exist?
  raise e
end

#generate_json(filepath) ⇒ Object



33
34
35
36
37
# File 'lib/kamome/cli.rb', line 33

def generate_json(filepath)
  path = ::Pathname.new(filepath)
  do_generate_json(operation_all, path)
  $stdout.puts "Generated json: #{path}"
end