Class: Cir::Cli::StatusCommand
- Inherits:
-
CommandWithRepository
- Object
- Command
- CommandWithRepository
- Cir::Cli::StatusCommand
- Defined in:
- lib/cir/cli/status_command.rb
Overview
Status command
Instance Attribute Summary
Attributes inherited from CommandWithRepository
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from CommandWithRepository
Methods inherited from Command
Constructor Details
This class inherits a constructor from Cir::Cli::CommandWithRepository
Instance Method Details
#opts ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cir/cli/status_command.rb', line 20 def opts Trollop::Parser.new do "Show status of registered files." opt :show_diff, "Show diffs for changed files", :default => false opt :all, "Display all files even those that haven't been changed", :default => false end end |
#process ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cir/cli/status_command.rb', line 28 def process files = self.repository.status(self.files.empty? ? nil : self.files) files.each do |file| diff = file.diff if diff.changed? puts "File #{file.file_path} changed." puts "#{diff.to_s}\n" if self.args[:show_diff] elsif self.args[:all] puts "File #{file.file_path} is the same." end end end |