Class: Rly::CLI

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

#add(name, url) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/rly/cli.rb', line 52

def add(name, url)
  if options[:help]
    invoke :help, ['add']
  else
    require_relative 'commands/add'
    Rly::Commands::Add.new(name, url, options).execute
  end
end

#listObject



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

def list(*)
  if options[:help]
    invoke :help, ['list']
  else
    require_relative 'commands/list'
    Rly::Commands::List.new(options).execute
  end
end

#open(name) ⇒ Object Also known as: o



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

def open(name)
  if options[:help]
    invoke :help, ['open']
  else
    require_relative 'commands/open'
    Rly::Commands::Open.new(name, options).execute
  end
end

#remove(name) ⇒ Object



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

def remove(name)
  if options[:help]
    invoke :help, ['remove']
  else
    require_relative 'commands/remove'
    Rly::Commands::Remove.new(name, options).execute
  end
end

#versionObject



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

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