Skip to content

Commit b809f26

Browse files
committed
doc: instuction on how to run the code
1 parent 6e0493a commit b809f26

File tree

2 files changed

+83
-9
lines changed

2 files changed

+83
-9
lines changed

README.md

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,91 @@
1-
# document-handler
1+
# Document Handler CLI
22

3-
### Running
3+
A powerful command-line utility for automating document processing workflows. This tool enables you to merge multiple documents into a single consolidated file. Perfect for combining reports, articles, or any collection of documents that need to be shared as one cohesive document.
44

5-
```js
5+
Currently, **Document Handler CLI** supports PDF files exclusively, with plans to expand support for additional formats including TXT, CSV, HTML, and other document types in future releases.
6+
7+
## Getting Started
8+
9+
### Prerequisites
10+
- Node.js version 18.0 or higher
11+
- npm package manager
12+
13+
### Installation
14+
1. Clone the repository or download the source code
15+
2. Install dependencies:
16+
```bash
17+
npm install
18+
```
19+
20+
3. Build the application:
21+
```bash
22+
npm run build
23+
```
24+
25+
### Usage
26+
27+
Run the `merge-documents` command with your input files, output file, and working directory:
28+
29+
```bash
630
npm run merge-documents -- -i TheHollowMen.pdf SatoshiPaper.pdf TheRed-HeadedLeague.pdf -o AnnualReading.pdf -w ./workdir
731
```
832

9-
npm run merge-documents -- -o AnnualReading.pdf -w ./workdir
33+
#### Command Options
34+
35+
- `-i, --input <files...>` - List of PDF files to merge (space-separated)
36+
- `-o, --output <file>` - Name of the merged output file
37+
- `-w, --working-directory <path>` - Directory containing input files and where output will be saved
38+
39+
#### Examples
40+
41+
**Basic usage:**
42+
```bash
43+
npm run merge-documents -- -i report1.pdf report2.pdf -o annual-report.pdf -w ./documents
44+
```
45+
46+
**Multiple files:**
47+
```bash
48+
npm run merge-documents -- -i chapter1.pdf chapter2.pdf chapter3.pdf appendix.pdf -o complete-book.pdf -w ./book-files
49+
```
50+
51+
**Using absolute paths:**
52+
```bash
53+
npm run merge-documents -- -i doc1.pdf doc2.pdf -o combined.pdf -w /home/user/documents
54+
```
55+
56+
#### Sample Files
57+
This project includes sample PDF files in the `workdir` folder for testing. You can specify any directory path for the `-w` argument as long as you have read/write permissions.
58+
59+
#### Notes
60+
- All input files must be valid PDF documents
61+
- The output file will be created in the specified working directory
62+
- If the output file already exists, it will be overwritten
63+
64+
### Testing
1065

11-
npm run merge-documents -- -i TheHollowMen.pdf SatoshiPaper.pdf TheRed-HeadedLeague.pdf -w ./workdir
66+
This project includes comprehensive test coverage with both unit and integration tests to ensure reliability and maintainability.
1267

13-
npm run merge-documents -- -i TheHollowMen.pdf SatoshiPaper.pdf TheRed-HeadedLeague.pdf -o AnnualReading.pdf
68+
#### Test Types
69+
- **Unit Tests**: Test individual components and functions in isolation
70+
- **Integration Tests**: Test CLI argument parsing and end-to-end workflows
71+
- **Coverage Reports**: Track code coverage across the entire codebase
1472

15-
npm run merge-documents -- -i TheHollowMen.txt SatoshiPaper.pdf TheRed-HeadedLeague.pdf -o AnnualReading.pdf -w ./workdir
73+
#### Running Tests
74+
75+
**Run all tests:**
76+
```bash
77+
npm run test
78+
```
79+
80+
**Run tests with coverage report:**
81+
```bash
82+
npm run test:coverage
83+
```
84+
85+
**Run integration tests only:**
86+
```bash
87+
npm run test:integration
88+
```
1689

17-
npm run merge-documents -- -i TheHollowMen.pdf SatoshiPaper.pdf TheRed-HeadedLeague.pdf -o AnnualReading.txt -w ./workdir
90+
## Author
91+
- [Kelvin Felix](https://github.com/KelvinFelix)

src/main/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ controller.handle({
2828
console.log("Message:", result.message)
2929

3030
if (result.exitCode !== 0) {
31-
console.error(result.data)
31+
console.error(result.data)
3232
}
3333
})

0 commit comments

Comments
 (0)