Class: Blockr::CLI

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

Overview

Handle the application command line parsing and the dispatch to various command objects

Constant Summary collapse

Error =

Error raised by this runner

Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#activateObject



37
38
39
40
41
42
43
44
# File 'lib/blockr/cli.rb', line 37

def activate(*)
  if options[:help]
    invoke :help, ['activate']
  else
    require_relative 'commands/activate'
    Blockr::Commands::Activate.new(options).execute
  end
end

#block(*websites) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/blockr/cli.rb', line 63

def block(*websites)
  if options[:help]
    invoke :help, ['block']
  else
    require_relative 'commands/block'
    Blockr::Commands::Block.new(websites, options).execute
  end
end

#deactivateObject



24
25
26
27
28
29
30
31
# File 'lib/blockr/cli.rb', line 24

def deactivate(*)
  if options[:help]
    invoke :help, ['deactivate']
  else
    require_relative 'commands/deactivate'
    Blockr::Commands::Deactivate.new(options).execute
  end
end

#unblock(*websites) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/blockr/cli.rb', line 50

def unblock(*websites)
  if options[:help]
    invoke :help, ['unblock']
  else
    require_relative 'commands/unblock'
    Blockr::Commands::Unblock.new(websites, options).execute
  end
end

#versionObject



15
16
17
18
# File 'lib/blockr/cli.rb', line 15

def version
  require_relative 'version'
  puts "v#{Blockr::VERSION}"
end