Giter Site home page Giter Site logo

daniel-iel / byreplace Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 10.59 MB

Enhance your delivery process with ByReplace. Its user-friendly features and intuitive design streamline development, making integration seamless.

License: MIT License

PowerShell 0.88% C# 98.23% Dockerfile 0.31% Makefile 0.58%
bulk cli replace dotnet

byreplace's Introduction

ByReplace Logo

Contributors Activity CI License Downloads Release Repo Size

About

ByReplace is a powerful command-line interface (CLI) tool designed for efficiently executing find-and-replace operations within source files. This versatile utility enables users to seamlessly modify text within their codebase, enhancing productivity and streamlining development processes. Whether you're updating variable names, correcting typos, or implementing sweeping changes across multiple files, ByReplace has you covered.

Get Started

To run ByReplace, you need Dotnet 8. After installing the NuGet package, navigate to your terminal and execute the command br -v. If the installation was successful, the following text will be displayed in your terminal:

br

Commands:
  apply    Apply commands
  rule     Rule commands

Options:
  -h, --help    Show help message
  --version     Show version

Installation

ByReplace is delivered via NuGet.

dotnet install -g ByReplace

Creating the Configuration File

Create a configuration file with the following structure:

{
  "Path": "",
  "SkipDirectories": [""],
  "Rules": [
    {
      "Name": "",
      "Description": "",
      "Skip": ["", ""],
      "Extensions": ["", ""],
      "Replacement": {
        "Old": ["", ""],
        "New": ""
      }
    }
  ]
}

JSON Configuration Documentation

This document provides a detailed explanation of the structure and purpose of each field within the provided JSON configuration file.

Path

  • Type: String
  • Purpose: Specifies the path where the operation should be performed. This can be a directory path or a file path depending on the context of the operation.
  • Example: "C:\Users\User\Documents"

SkipDirectories

  • Type: Array of Strings
  • Purpose: Lists directories that should be skipped during the operation. Each entry in the array represents a directory path.
  • Example: ["Temp", "Logs"]

Rules

  • Type: Array of Objects
  • Purpose: Defines a set of rules to apply during the operation. Each rule object contains specific configurations for how files or directories should be handled.

Name

  • Type: String
  • Purpose: A descriptive name for the rule. Used for identification purposes.
  • Example: "BackupRule"

Description

  • Type: String
  • Purpose: Provides a brief description of what the rule does.
  • Example: "Moves all .txt files to the backup folder."

Skip

  • Type: Array of Strings
  • Purpose: Lists specific files or patterns of files to skip when applying this rule. Useful for excluding certain types of files from being processed.
  • Example: [".tmp", "~"]

Extensions

  • Type: Array of Strings
  • Purpose: Specifies the file extensions that this rule applies to. Only files with these extensions will be considered for processing according to this rule.
  • Example: [".docx", ".pdf"]

Replacement

  • Type: Object
  • Purpose: Contains configurations for replacing parts of the file paths or names as per the rule's requirements.

Old

  • Type: Array of Strings
  • Purpose: Lists the old strings or patterns that should be replaced in the file paths or names.
  • Example: ["temp", "backup"]

New

  • Type: String
  • Purpose: The new string or pattern that replaces the old ones specified in the Old array.
  • Example: "archive"

Commands

Apply

apply rule: Executes a specific rule from the configuration file.

  • -r: Rule's name.
  • -p: Path of files to execute the apply.
  • -f: Folder's path that contains the configuration file.
br apply rule -r "Rule" -p "C:/three_files" -f "C:/"

apply rules: Executes all rules from the configuration file.

  • -p: Path of files to execute the apply.
  • -f: Folder's path that contains the configuration file.
br apply rules -p "C:/three_files" -f "C:/"

Rule

rule list-rules: Lists all rules from the configuration file.

  • -f: Folder's path that contains the configuration file.
br rule list-rules -f "C:/"

rule open-rule: Gets a rule by its name.

  • -n: Rule's name.
  • -f: Folder's path that contains the configuration file.
br rule open-rule -n "rule name" -f "C:/"

License

Our code and framework are licensed under the MIT license. Please see the license file for more information. You can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source.

byreplace's People

Contributors

daniel-iel avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.