Module: Lingvo::Console

Defined in:
lib/lingvo/console/command.rb

Defined Under Namespace

Classes: Command

Constant Summary collapse

HELP =
"""
Lingvo #{VERSION}

Options:
  --parse file  - parse lingvoleo HTML file with words
  --rand count  - show 'n' random records
  --notify      - show `word - translation` with your notification
  --gui         - show words in simpe window
                  key:  n - show next word
                        q - close window

  --wc f1 [f2]  - parse text file(f1), and write statistic to file(f2)
                  or show in console if file(f2) isn't specify

  --size        - show words count
  -v            - show version
  -h            - show this help

Description:

  ○ Load words from lingualeo.ru and train with lingvo
    · go to lingualeo site
    · select words which you want
    · go to print page and save it (like: print.html)

    · $ lingvo --parse print.html
    · Well Done!!! Now You have all words in lingvo ;)

  ○ Parse document and build statistics
    · save your text like english.txt file

    · $ lingvo --wc english.txt
    · show your statistic immediatly in console

    · $ lingvo --wc english.txt statistics.txt
    · open statistics.txt and see your words amount

"""

Class Method Summary collapse

Class Method Details

.no_wordObject



54
55
56
57
# File 'lib/lingvo/console/command.rb', line 54

def no_word
  Command.words_not_found
  exit
end

.which(cmd) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/lingvo/console/command.rb', line 43

def which(cmd)
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    exts.each do |ext|
      exe = File.join(path, "#{cmd}#{ext}")
      return exe if File.executable? exe
    end
  end
  nil
end