Class: GitAuto::Commands::HistoryAnalysisCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/git_auto/commands/history_analysis_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ HistoryAnalysisCommand

Returns a new instance of HistoryAnalysisCommand.



6
7
8
9
10
11
# File 'lib/git_auto/commands/history_analysis_command.rb', line 6

def initialize(options = {})
  @limit = options[:limit] || 10
  @git_service = Services::GitService.new
  @prompt = TTY::Prompt.new
  @spinner = TTY::Spinner.new("[:spinner] Analyzing commit history...")
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/git_auto/commands/history_analysis_command.rb', line 13

def execute
  @spinner.auto_spin
  commits = fetch_commits
  analysis = analyze_commits(commits)
  @spinner.success
  display_results(analysis)
rescue StandardError => e
  puts "❌ Error analyzing commits: #{e.message}".red
  exit 1
end