class Cir::Cli::StatusCommand

Status command

Public Instance Methods

opts() click to toggle source
# File lib/cir/cli/status_command.rb, line 20
def opts
  Trollop::Parser.new do
    banner "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() click to toggle source
# 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