Sha256: b3bcb68d5bbcd88eef3b71343786905912544b3263a442dabdb056f373f30c7e

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

#encoding: UTF-8
module Termit
  class OutputManager
    def display_error_info_and_quit
      puts "TERMIT: Wrong data. Example: 'termit en es the cowboy' => 'el vaquero'"
      exit
    end

    def display_player_error_and_quit
      message = "TERMIT: speech synthesis requires mpg123 installed."
      case Gem::Platform.local.os
      when "darwin"
        message << "\nPlease run 'brew install mpg123'"
      when "linux"
        message << "\nPlease run 'sudo apt-get install mpg123'"
      end
      abort message
    end

    def display_help_and_quit
      puts    <<-EOS
=========TERMIT=========
Usage:
termit 'source_language' 'target_language' 'text'

Example:
termit en fr 'hey cowboy where is your horse?'
=> 'hey cow-boy ou est votre cheval?'

Options:
-t - speech synthesis
-s - synonyms list

Check docs at: github.com/pawurb/termit
EOS
      exit
    end


    def display_version_and_quit
      puts "Termit #{Termit::VERSION}"
      exit
    end

    def display_translation text
      print "=> "
      puts text
    end

    def display_synonyms synonyms
      print '=> Synonyms: '
      puts synonyms
    end

    def display_no_internet_msg
      puts "TERMIT: There seems to be a problem with your internet connection"
      exit
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
termit-2.13.0 lib/termit/output_manager.rb
termit-2.12.1 lib/termit/output_manager.rb
termit-2.12.0 lib/termit/output_manager.rb
termit-2.11.2 lib/termit/output_manager.rb
termit-2.11.1 lib/termit/output_manager.rb
termit-2.11.0 lib/termit/output_manager.rb
termit-2.10.2 lib/termit/output_manager.rb