Class: CheckstyleFilter::Git::CLI
- Inherits:
-
Thor
- Object
- Thor
- CheckstyleFilter::Git::CLI
- Defined in:
- lib/checkstyle_filter/git/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
7 8 9 |
# File 'lib/checkstyle_filter/git/cli.rb', line 7 def self.exit_on_failure? true end |
Instance Method Details
#diff(commit_ish = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/checkstyle_filter/git/cli.rb', line 14 def diff(commit_ish = nil) data = \ if [:data] [:data] elsif [:file] File.read([:file]) elsif !$stdin.tty? ARGV.clear ARGF.read end abort if !data || data.empty? command = ['git', 'diff', '--no-color', commit_ish].compact git_diff, _, _ = Open3.capture3(*command) puts ::CheckstyleFilter::Git::Filter.filter(data, git_diff) end |
#version ⇒ Object
35 36 37 |
# File 'lib/checkstyle_filter/git/cli.rb', line 35 def version puts "CheckstyleFilter/Git version #{::CheckstyleFilter::Git::VERSION}" end |