Class: Ace::Overseer::CLI::Commands::Prune
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Overseer::CLI::Commands::Prune
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/overseer/cli/commands/prune.rb
Instance Method Summary collapse
- #call(**options) ⇒ Object
-
#initialize(orchestrator: nil, input: $stdin, output: $stdout) ⇒ Prune
constructor
A new instance of Prune.
Constructor Details
#initialize(orchestrator: nil, input: $stdin, output: $stdout) ⇒ Prune
Returns a new instance of Prune.
21 22 23 24 25 26 |
# File 'lib/ace/overseer/cli/commands/prune.rb', line 21 def initialize(orchestrator: nil, input: $stdin, output: $stdout) super() @orchestrator = orchestrator || Organisms::PruneOrchestrator.new @input = input @output = output end |
Instance Method Details
#call(**options) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ace/overseer/cli/commands/prune.rb', line 28 def call(**) Atoms::RepoGuard.ensure_repo! targets = Array([:targets] || []) progress = [:quiet] ? nil : ->(msg) { puts msg } result = @orchestrator.call( dry_run: [:dry_run], yes: [:yes], force: [:force], targets: targets, assignment_id: [:assignment], input: @input, output: @output, on_progress: progress ) return if [:quiet] if [:assignment] print_assignment_result(result) return end if result[:dry_run] print_dry_run(result) return end if result[:aborted] puts "Prune aborted." return end print_apply(result) rescue => e raise Ace::Support::Cli::Error.new(e.) end |