Class: Committer::Commands::Default
- Inherits:
-
Object
- Object
- Committer::Commands::Default
- Defined in:
- lib/committer/commands/default.rb
Class Method Summary collapse
Class Method Details
.execute(_args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/committer/commands/default.rb', line 20 def self.execute(_args) diff = Committer::CommitGenerator.check_git_status if diff.empty? puts 'No changes are staged for commit.' exit 0 end # Prompt user for commit context puts 'Why are you making this change? (Press Enter to skip)' commit_context = gets.chomp execute_commit(diff, commit_context) rescue Clients::ClaudeClient::ConfigError, StandardError => e puts "Error: #{e.}" exit 1 end |
.execute_commit(diff, commit_context) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/committer/commands/default.rb', line 6 def self.execute_commit(diff, commit_context) commit_generator = Committer::CommitGenerator.new(diff, commit_context) = commit_generator. summary = [:summary] body = [:body] # Create git commit with the suggested message and open in editor if body system('git', 'commit', '-m', summary, '-m', body, '-e') else system('git', 'commit', '-m', summary, '-e') end end |