class Smartdict::Gui::Cli

Handles options for smartdict-gtk command.

Public Class Methods

run(args) click to toggle source
# File lib/smartdict/gui/cli.rb, line 3
def self.run(args)
  case args.first
  when nil, /\s+/
    run_application
  when '-v', '--version', 'version'
    puts version_message
  when '-h', '--help', 'help', /\w+/
    puts help_message
  end
end

Private Class Methods

help_message() click to toggle source
# File lib/smartdict/gui/cli.rb, line 31
def self.help_message
  "Smartdict GUI(gtk)\n\n" \
  "  Usage:\n" \
  "    smartdict-gtk              run the application\n" \
  "    smartdict-gtk --version    see version\n" \
  "    smartdict-gtk --help       see help message\n" \
end
run_application() click to toggle source
# File lib/smartdict/gui/cli.rb, line 17
def self.run_application
  Smartdict.env = :user
  Smartdict.run
  Smartdict::Gui.run
end
version_message() click to toggle source
# File lib/smartdict/gui/cli.rb, line 23
def self.version_message
  info = Smartdict.info
  "Smartdict GUI(gtk) v#{Smartdict::Gui::VERSION}\n" \
  "Smartdict core v#{info.version}\n" \
  "Author: #{info.author} (#{info.email})\n" \
  "URL: #{info.url}\n" \
end