class Spoom::Cli::Deadcode
def remove(location_string)
def remove(location_string) location = Location.from_string(location_string) context = self.context remover = Spoom::Deadcode::Remover.new(context) new_source = remover.remove_location(nil, location) context.write!("PATCH", new_source) diff = context.exec("diff -u #{location.file} PATCH") $stderr.puts T.must(diff.out.lines[2..-1]).join context.remove!("PATCH") context.write!(location.file, new_source) rescue Spoom::Deadcode::Remover::Error => e say_error("Can't remove code at #{location_string}: #{e.message}") exit(1) rescue Location::LocationError => e say_error(e.message) exit(1) end