Skip to content

Commit

Permalink
add readme text
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-iel committed May 19, 2024
1 parent 8d6a92f commit 0ad5622
Showing 1 changed file with 90 additions and 37 deletions.
127 changes: 90 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,157 @@
<div align="center">
<img src="./assets/br-logo-ascii.png?raw=true">
<img src="./assets/br-logo-ascii.png?raw=true" alt="ByReplace Logo">
</div>

#

[![Contributors](https://img.shields.io/github/contributors/Daniel-iel/ByReplace)](https://www.nuget.org/packages/ByReplace/)
[![Activity](https://img.shields.io/github/commit-activity/m/Daniel-iel/ByReplace)](https://www.nuget.org/packages/ByReplace/)
[![ci](https://github.com/Daniel-iel/ByReplace/actions/workflows/ci.yml/badge.svg)](https://github.com/Daniel-iel/ByReplace/actions/workflows/ci.yml/badge.svg/)
[![CI](https://github.com/Daniel-iel/ByReplace/actions/workflows/ci.yml/badge.svg)](https://github.com/Daniel-iel/ByReplace/actions/workflows/ci.yml/badge.svg/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
[![Downloads](https://img.shields.io/nuget/dt/ByReplace)](https://www.nuget.org/packages/ByReplace/)
[![Release](https://img.shields.io/nuget/v/ByReplace)](https://www.nuget.org/packages/ByReplace/)
[![Repo Size](https://img.shields.io/github/repo-size/Daniel-iel/ByReplace)](https://www.nuget.org/packages/ByReplace/)

# 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** 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

[Dotnet 8](https://dotnet.microsoft.com/en-us/download) is required to run ByReplace.
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.
To run ByReplace, you need [Dotnet 8](https://dotnet.microsoft.com/en-us/download). 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:

```shell
br

Commands:
apply apply commands
rule rule commands
apply Apply commands
rule Rule commands

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

## Install
# Installation

ByReplace tool is delivery by [nuget](https://www.nuget.org/packages/ByReplace).
ByReplace is delivered via NuGet.

```shell
dotnet install -g ByReplace
```

## How Create the Configuration File
# Creating the Configuration File

Create a configuration file with the following structure:

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

### Path
# JSON Configuration Documentation

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

### Rules
## 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"

## Commands
## 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"]

### Apply
## 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.

`br apply rule`: Is used to execute only one rule from brConfiguration file.
## Name
- Type: String
- Purpose: A descriptive name for the rule. Used for identification purposes.
- Example: "BackupRule"

- `-r`: rule's name.
- `-p`: path of files to execute the apply.
- `-f`: folder's path that constains the brConfiguration file.
## Description
- Type: String
- Purpose: Provides a brief description of what the rule does.
- Example: "Moves all .txt files to the backup folder."

```shell
br apply rule -r "Rule" -p "C:/{three files" -f "C:"
```
## 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", "~"]

`br apply rules`: Is used to execute all rules rule from brConfiguration file.
## 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"]

- `-p`: path of files to execute the apply.
- `-f`: folder's path that constains the brConfiguration file.
## Replacement
- Type: Object
- Purpose: Contains configurations for replacing parts of the file paths or names as per the rule's requirements.

```shell
br apply rules -p "C:/{three files" -f "C:"
```
### 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"]

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

`br rule list-rules`
# Commands

```shell
## 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.

```bash
br apply rule -r "Rule" -p "C:/three_files" -f "C:/"
```

`br rule open-rule`
`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.

```shell
```bash
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.

```bash
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.

```bash
br rule open-rule -n "rule name" -f "C:/"
```

0 comments on commit 0ad5622

Please sign in to comment.