Class: Matheus::QuickCommit
- Defined in:
- lib/matheus/quick_commit.rb
Instance Method Summary collapse
-
#call ⇒ Object
Usage: $ quick-commit.
Methods inherited from Command
Methods included from StringFormat
Methods included from Result::Methods
Instance Method Details
#call ⇒ Object
Usage:
$ quick-commit
5 6 7 8 9 10 11 12 |
# File 'lib/matheus/quick_commit.rb', line 5 def call(*) diff = `git diff --cached` return Failure("No changes to commit.") if diff.blank? Q.call(["Please write a good one-line commit message for the following diff. Return only plain-text. Diff:\n#{diff}"], skip_cache: true) .on_success { |msg| confirm("Accept commit message?", return_value: msg) } .on_success { || system(%(git commit -m "#{commit_message}"), out: :close) } end |