Class: Findr::CLI
- Inherits:
-
Thor
- Object
- Thor
- Findr::CLI
- Defined in:
- lib/findr/cli.rb
Instance Method Summary collapse
- #find_and_replace(pattern, replacement, path = '**/*') ⇒ Object
-
#help ⇒ Object
Show help by not using default feature of Thor, because this ‘findr’ command do not need arguments.
Instance Method Details
#find_and_replace(pattern, replacement, path = '**/*') ⇒ Object
9 10 11 |
# File 'lib/findr/cli.rb', line 9 def find_and_replace(pattern, replacement, path = '**/*') Findr.new(pattern, replacement, path, ).find_and_replace end |
#help ⇒ Object
Show help by not using default feature of Thor, because this ‘findr’ command do not need arguments.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/findr/cli.rb', line 14 def help print <<~EOT #{'findr'.bold} -- Find files in directory recursively and replace texts in the files. #{'Usage'.bold} findr pattern replacement [path] #{'Examples'.bold} # Replace 'apple' to 'lemon' in all files in current and children directory $ findr "apple" "lemon" # Delete a line with 'require' in all ruby file $ findr "require(.*?)\\n" "" "**/*.rb" #{'Details'.bold} -v, --verbose Verbose mode. EOT end |