Class: Ever2boost::CLI

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

Constant Summary collapse

DEFAULT_OUTPUT_DIR =
"#{ENV['HOME']}/evernote_storage".freeze
DEFAULT_OUTPUT_DIR_ENEX =
"#{ENV['HOME']}/evernote_storage_enex".freeze

Instance Method Summary collapse

Instance Method Details

#__print_versionObject



31
32
33
# File 'lib/ever2boost/cli.rb', line 31

def __print_version
  puts Ever2boost::VERSION
end

#convert(path) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/ever2boost/cli.rb', line 21

def convert(path)
  output_dir = options[:directory] || DEFAULT_OUTPUT_DIR_ENEX
  abort Util.red_output("Error! No such file or directory: #{path}") unless File.exist?(path)
  enex = File.read(path)
  filename = File.basename(path, '.enex')
  EnexConverter.convert(enex, output_dir, filename)
end

#importObject



13
14
15
16
17
# File 'lib/ever2boost/cli.rb', line 13

def import
  output_dir = options[:directory] || DEFAULT_OUTPUT_DIR
  developer_token = ask('DEVELOPER_TOKEN:')
  EvernoteAuthorizer.new(developer_token).import(output_dir)
end