Class: Ace::Git::CLI::Commands::Diff

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

Overview

ace-support-cli command for generating diffs Migrated from ace-git-diff

Instance Method Summary collapse

Instance Method Details

#call(range: nil, **options) ⇒ Object



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/git/cli/commands/diff.rb', line 41

def call(range: nil, **options)
  # Verify we're in a git repository
  unless Atoms::CommandExecutor.in_git_repo?
    raise Ace::Git::GitError, "Not a git repository (or any of the parent directories)"
  end

  # Build options hash, including any custom config file
  diff_options = build_options(range, options)

  # Generate diff
  result = if options[:raw]
    Organisms::DiffOrchestrator.raw(diff_options)
  else
    Organisms::DiffOrchestrator.generate(diff_options)
  end

  # Output result
  output_result(result, options)

  # Return success
  0
rescue Ace::Git::Error => e
  raise Ace::Support::Cli::Error.new(e.message)
end