Class: CobraCommander::CLI

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

Overview

Implements the tool’s CLI

Instance Method Summary collapse

Instance Method Details

#changesObject



68
69
70
# File 'lib/cobra_commander/cli.rb', line 68

def changes
  Change.new(umbrella, options.results, options.branch).run!
end

#exec(command_or_component, command = nil) ⇒ Object



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

def exec(command_or_component, command = nil)
  CobraCommander::Executor.exec(
    components_filtered(command && command_or_component),
    command ? command : command_or_component
  )
end

#graph(component = nil) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/cobra_commander/cli.rb', line 55

def graph(component = nil)
  CobraCommander::Output::GraphViz.generate(
    find_component(component),
    options.output
  )
  puts "Graph generated at #{options.output}"
rescue ArgumentError => error
  error error.message
end

#ls(component = nil) ⇒ Object



30
31
32
33
# File 'lib/cobra_commander/cli.rb', line 30

def ls(component = nil)
  components = components_filtered(component)
  puts options.total ? components.size : CobraCommander::Output::FlatList.new(components).to_s
end

#tree(component = nil) ⇒ Object



47
48
49
50
# File 'lib/cobra_commander/cli.rb', line 47

def tree(component = nil)
  component = find_component(component)
  puts CobraCommander::Output::AsciiTree.new(component).to_s
end

#versionObject



20
21
22
# File 'lib/cobra_commander/cli.rb', line 20

def version
  puts CobraCommander::VERSION
end