Class: Warp::Dir::Command::Clean

Inherits:
Warp::Dir::Command show all
Defined in:
lib/warp/dir/command/clean.rb

Instance Attribute Summary

Attributes inherited from Warp::Dir::Command

#formatter, #point, #point_name, #point_path, #store

Instance Method Summary collapse

Methods inherited from Warp::Dir::Command

command_name, #config, help, inherited, #initialize, #inspect, installed_commands, #needs_point?, #on, #puts

Constructor Details

This class inherits a constructor from Warp::Dir::Command

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/warp/dir/command/clean.rb', line 8

def run(*)
  removed = store.clean!
  s = self.store
  if removed.empty?
    on :success do
      message "All entries are valid in your file #{s.config.warprc.blue} are #{'valid.'.green}"
    end
  else
    on :success do
      message "The following no-longer existing points have been removed:\n\n".bold +
                ::Warp::Dir::Formatter::StoreFormatter.new(removed).format.bold.red
    end
  end
end