Class: RubyEdit::CLI

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

#configureObject



42
43
44
45
46
47
48
49
# File 'lib/ruby_edit/cli.rb', line 42

def configure(*)
  if options[:help]
    invoke :help, ['configure']
  else
    require_relative 'commands/configure'
    RubyEdit::Commands::Configure.new(options).execute
  end
end

#editObject



57
58
59
60
61
62
63
64
65
66
# File 'lib/ruby_edit/cli.rb', line 57

def edit(*)
  if options[:help]
    invoke :help, ['edit']
  elsif options.empty?
    invoke :help
  else
    require_relative 'commands/edit'
    RubyEdit::Commands::Edit.new(options).execute
  end
end

#grepObject



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

def grep(*)
  if options[:help]
    invoke :help, ['grep']
  else
    require_relative 'commands/grep'
    RubyEdit::Commands::Grep.new(options).execute
  end
end

#versionObject



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

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