FEATURE: posts:remap task now supports removing all occurences of a word

This commit is contained in:
Arpit Jalan 2017-01-24 12:00:57 +05:30
parent eafd0a7497
commit e27ca3019b
1 changed files with 6 additions and 1 deletions

View File

@ -118,11 +118,16 @@ end
desc 'Remap all posts matching specific string'
task 'posts:remap', [:find, :replace] => [:environment] do |_,args|
require 'highline/import'
find = args[:find]
replace = args[:replace]
if !find || !replace
if !find
puts "ERROR: Expecting rake posts:remap[find,replace]"
exit 1
elsif !replace
confirm_replace = ask("Are you sure you want to remove all occurences of '#{find}'? (Y/n) ")
exit 1 unless (confirm_replace == "" || confirm_replace.downcase == 'y')
end
puts "Remapping"