|
1 | | -# document-handler |
| 1 | +# Document Handler CLI |
2 | 2 |
|
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. |
4 | 4 |
|
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 |
6 | 30 | npm run merge-documents -- -i TheHollowMen.pdf SatoshiPaper.pdf TheRed-HeadedLeague.pdf -o AnnualReading.pdf -w ./workdir |
7 | 31 | ``` |
8 | 32 |
|
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 |
10 | 65 |
|
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. |
12 | 67 |
|
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 |
14 | 72 |
|
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 | +``` |
16 | 89 |
|
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) |
0 commit comments