Class: CobraCommander::CLI
- Inherits:
-
Thor
- Object
- Thor
- CobraCommander::CLI
- Defined in:
- lib/cobra_commander/cli.rb,
lib/cobra_commander/cli/filters.rb
Constant Summary collapse
- DEFAULT_CONCURRENCY =
(Concurrent.processor_count / 2.0).ceil
Instance Method Summary collapse
- #changes ⇒ Object
- #exec(command_or_component, command = nil) ⇒ Object
- #graph(component = nil) ⇒ Object
- #ls(component = nil) ⇒ Object
- #tree(component = nil) ⇒ Object
- #version ⇒ Object
Instance Method Details
#changes ⇒ Object
82 83 84 |
# File 'lib/cobra_commander/cli.rb', line 82 def changes Change.new(umbrella, .results, .branch).run! end |
#exec(command_or_component, command = nil) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cobra_commander/cli.rb', line 46 def exec(command_or_component, command = nil) results = CobraCommander::Executor.exec( components: components_filtered(command && command_or_component), command: command || command_or_component, concurrency: .concurrency, status_output: $stderr ) if .interactive && results.size > 1 CobraCommander::Output::InteractivePrinter.run(results, $stdout) else CobraCommander::Output::MarkdownPrinter.run(results, $stdout) end end |
#graph(component = nil) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/cobra_commander/cli.rb', line 69 def graph(component = nil) CobraCommander::Output::GraphViz.generate( find_component(component), .output ) puts "Graph generated at #{.output}" rescue ArgumentError => e error e. end |
#ls(component = nil) ⇒ Object
33 34 35 36 |
# File 'lib/cobra_commander/cli.rb', line 33 def ls(component = nil) components = components_filtered(component) puts .total ? components.size : CobraCommander::Output::FlatList.new(components).to_s end |
#tree(component = nil) ⇒ Object
61 62 63 64 |
# File 'lib/cobra_commander/cli.rb', line 61 def tree(component = nil) component = find_component(component) puts CobraCommander::Output::AsciiTree.new(component).to_s end |
#version ⇒ Object
25 26 27 |
# File 'lib/cobra_commander/cli.rb', line 25 def version puts CobraCommander::VERSION end |