Class: Rubyists::Opr::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rubyists::opr/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)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/rubyists::opr/cli.rb', line 16

def self.exit_on_failure?
  true
end

Instance Method Details

#gen(path = nil) ⇒ Object



72
73
74
75
76
77
78
79
# File 'lib/rubyists::opr/cli.rb', line 72

def gen(path = nil)
  if options[:help]
    invoke :help, ['gen']
  else
    require_relative 'commands/gen'
    Rubyists::Opr::Commands::Gen.new(path, options).execute
  end
end

#get(item) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/rubyists::opr/cli.rb', line 45

def get(item)
  if options[:help]
    invoke :help, ['get']
  else
    require_relative 'commands/get'
    Rubyists::Opr::Commands::Get.new(item, options).execute
  end
end

#rm(item) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/rubyists::opr/cli.rb', line 32

def rm(item)
  if options[:help]
    invoke :help, ['rm']
  else
    require_relative 'commands/rm'
    Rubyists::Opr::Commands::Rm.new(item, options).execute
  end
end

#versionObject



21
22
23
24
# File 'lib/rubyists::opr/cli.rb', line 21

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