cdl-vinay
v1.0.0
Published
A Command-Line Interface (CLI) tool for performing various file operations using Node.js. This tool allows you to create, read, write, edit, count words and lines, and delete files from the terminal.
Downloads
3
Readme
file-operations-cli
A Command-Line Interface (CLI) tool for performing various file operations using Node.js. This tool allows you to create, read, write, edit, count words and lines, and delete files from the terminal.
Features
- Count Words: Count the number of words in a file.
- Count Lines: Count the number of lines in a file.
- Create File: Create a new file if it does not already exist.
- Read File: Read and display the content of a file.
- Write File: Write content to a file.
- Edit File: Replace specified text in a file with new content.
- Delete File: Delete a specified file.
Installation
Clone the repository:
git clone https://github.com/Rajput-vinay/file-operations-cli.git
Navigate to the project directory:
cd file-operations-cli
Install the dependencies:
npm install
Run in terminal:
npm link
Usage
You can use the CLI tool by running the following commands:
Count Words
```bash
cdl-vinay countWord <file>
Create File
cdl-vinay createFile <file>
### Count Lines
```bash
cdl-vinay countLine <file>
### Read File
```bash
cdl-vinay readFile <file>
### Write File
```bash
cdl-vinay writeFile <file> <content>
### Edit File
```bash
cdl-vinay editFile <file> <oldText> <newText>
###Delete File
```bash
cdl-vinay deleteFile <file>
#Example
To count the number of words in a file named example.txt:
```bash
cdl-vinay countWord example.txt
## Contributing
1. **Fork the repository** to your own GitHub account.
2. **Create a new branch** for your feature or bug fix.
3. **Make your changes** and test them.
4. **Submit a pull request** with a description of the changes.