6

GitHub - elliot40404/fr: find and replace

 2 years ago
source link: https://github.com/elliot40404/fr
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

FR - find and replace

    __________
   / ____/ __ \
  / /_  / /_/ /
 / __/ / _, _/
/_/   /_/ |_|
fr - Find and Replace in files
Version: 0.1.0

Features

  • Find and replace text in files
  • Find and replace text in files with regex recursively
  • Find and replace text in files with specific extensions

Upcoming features

  • Ability to target by filename
  • Ability to exclude directories
  • Ability to exclude files with specific extensions/names
  • Ability to install with package managers
  • Use rust tools if available
  • Ability to use multiple find and replace patterns

Installation

git clone https://github.com/elliot40404/fr
cd fr
chmod +x install.sh
./install.sh
sudo curl -o- https://raw.githubusercontent.com/elliot40404/fr/master/install.sh | bash
sudo wget -qO- https://raw.githubusercontent.com/elliot40404/fr/master/install.sh | bash

Usage

fr [directory]* [pattern]* [new_value]* [extension] [deep]

* = Required argument

Argument Description Required Default

first argument [directory] The directory to search in yes none

second argument [pattern] The pattern to search for yes none

third argument [new_value] The new value to replace the pattern with yes none

-e, --extension files with extension to search for no All files

-d, --deep Whether to search in subdirectories no false

-h, --help Print help menu

Examples

Replace foo with bar in all files in the current directory:

fr . "foo" "bar"

Replace foo with bar in all files in the test directory:

fr test/ "foo" "bar"

Replace foo with bar in all javascript files in the test directory:

fr test/ "foo" "bar" -e js

Replace foo with bar in all files in the test directory and its subdirectories:

fr test/ "foo" "bar" -d

Replace foo with bar in all javascript files in the test directory and its subdirectories:

fr test/ "foo" "bar" -e js -d

License


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK