Class: Ace::Demo::CLI::Commands::Attach

Inherits:
Support::Cli::Command
  • Object
show all
Includes:
Support::Cli::Base
Defined in:
lib/ace/demo/cli/commands/attach.rb

Instance Method Summary collapse

Instance Method Details

#call(file:, **options) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ace/demo/cli/commands/attach.rb', line 19

def call(file:, **options)
  pr = options[:pr]
  raise Ace::Support::Cli::Error, "PR number is required. Use --pr <number>." if pr.to_s.strip.empty?

  attacher = Organisms::DemoAttacher.new
  result = attacher.attach(file: file, pr: pr, dry_run: options[:dry_run])
  Atoms::AttachOutputPrinter.print(result)
rescue ArgumentError, PrNotFoundError, GhAuthenticationError, GhUploadError, GhCommentError, GhCommandError,
  AggNotFoundError, AggExecutionError => e
  raise Ace::Support::Cli::Error, e.message
end