Class: Yiban::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/yiban/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



9
10
11
# File 'lib/yiban/cli.rb', line 9

def self.source_root
  File.expand_path('../..', __dir__)
end

Instance Method Details

#configObject



14
15
16
17
18
19
20
21
22
# File 'lib/yiban/cli.rb', line 14

def config

  config_path = Dir.home + '/.yiban'
  if Dir.exist?(config_path)
    puts "Your current name is [#{Yiban.config[:name]}]."
  else
    template 'templates/settings.yml.tt', "http://#{config_path}/settings.yml"
  end
end

#word(word) ⇒ Object



26
27
28
# File 'lib/yiban/cli.rb', line 26

def word(word)
  puts Yiban::Text.new(word).json
end