chore: update with new options and src layout

This commit is contained in:
Jesús Pérex 2025-05-26 19:12:56 +01:00
parent a4929cb448
commit 75111d12ed

View File

@ -7,10 +7,27 @@
> [!NOTE] > [!NOTE]
> Source files will be converted if are changed or not exist in target path > Source files will be converted if are changed or not exist in target path
## Table of Contents
- [Overview](#overview)
- [Repository Content](#repository-content)
- [MacOS APP](#macos-app)
- [Terminal Commands](#terminal-commands)
- [Basic Usage](#basic-usage)
- [Options](#options)
- [Examples](#examples)
- [Log Levels](#log-levels)
- [Notes](#notes)
- [Settings](#settings)
- [Just](#just)
- [Recipes](#recipes)
- [Main Values](#main-values)
- [For Development](#for-development)
- [To work on app](#to-work-on-app)
## Overview
The following extensions will be converted via LibreOffice **soffice** command. The following extensions will be converted via LibreOffice **soffice** command.
**FILES_TO_CONVERT**: odt, doc, docx **FILES_TO_CONVERT**: odt, doc, docx
The following extensions or path will be copied to **target** with any conversion The following extensions or path will be copied to **target** with any conversion
@ -21,7 +38,7 @@ The following path will be ignored during [clean_target_directory](src/directory
**PATHS_TO_IGNORE**: .DS_Store, .syncthing, .sync-conflict-, .stfolder, .stversions **PATHS_TO_IGNORE**: .DS_Store, .syncthing, .sync-conflict-, .stfolder, .stversions
## Repository content ## Repository Content
<pre> <pre>
. .
@ -77,6 +94,70 @@ MACOS_APP_PATH := "DirOdtToPdf.app"
<small>In MacOS [install.command](macos/install.command) copy above commands to BIN_APP_PATH(/usr/local/bin)</small> <small>In MacOS [install.command](macos/install.command) copy above commands to BIN_APP_PATH(/usr/local/bin)</small>
## Basic Usage
```bash
dir-odt-to-pdf <SOURCE_DIR> <TARGET_DIR> [OPTIONS]
```
### Options
```
Required Arguments:
<SOURCE_DIR> Source directory with .odt, .doc, or .docx files
<TARGET_DIR> Target directory for PDFs converted files
Optional Arguments:
--log-file <path> Write logs to file instead of console
--log-level <level> Set log level (error/warn/info/debug/trace)
Default: info
--append-log Append to existing log file instead of overwriting
-h, --help Print help
-V, --version Print version
```
### Examples
1. Basic conversion (logs to console):
```bash
dir-odt-to-pdf /path/to/documents /path/to/pdfs
```
2. Log to file:
```bash
dir-odt-to-pdf /path/to/documents /path/to/pdfs --log-file conversion.log
```
3. Debug level logging to console:
```bash
dir-odt-to-pdf /path/to/documents /path/to/pdfs --log-level debug
```
4. Append to existing log file with custom level:
```bash
dir-odt-to-pdf /path/to/documents /path/to/pdfs \
--log-file conversion.log \
--log-level debug \
--append-log
```
### Log Levels
Available log levels in increasing verbosity:
- `error`: Only errors that prevent normal operation
- `warn`: Warnings about potential issues
- `info`: General progress information (default)
- `debug`: Detailed information for troubleshooting
- `trace`: Very detailed debugging information
### Notes
- When `--log-file` is specified, output goes only to the file (not to console)
- Without `--append-log`, the log file is overwritten each time
- The program will create the target directory if it doesn't exist
- Existing PDF files are only updated if the source file is newer
### Settings
[justfile](justfile) settings: [justfile](justfile) settings:
```bash ```bash
@ -132,6 +213,11 @@ BIN_APP_PATH := "/usr/local/bin"
## For Development ## For Development
> [!NOTE]
> [Command-line-options](#options) can be added
> RUST_LOG environment variable controls env_logger output
| Recipe | alias | Descripción | parameters | | Recipe | alias | Descripción | parameters |
|--------|-------|--------------|--------------------| |--------|-------|--------------|--------------------|
| **build** | b | run cargo | cargo arguments | | **build** | b | run cargo | cargo arguments |
@ -143,7 +229,7 @@ BIN_APP_PATH := "/usr/local/bin"
| **doc** | d | run cargo doc --open --no-deps | cargo arguments | | **doc** | d | run cargo doc --open --no-deps | cargo arguments |
| **benchmark** | be | run cargo bench | cargo arguments | | **benchmark** | be | run cargo bench | cargo arguments |
| **test*** | be | run cargo t | cargo arguments | | **test*** | be | run cargo t | cargo arguments |
| **runtest** | rt | run [run.sh](run.sh) script using [test](test) directories for **SOURCE** and **DEST** parametets | | | **runtest** | rt | run [run.sh](run.sh) script using [test](test) directories for **SOURCE** and **DEST** parametets <br> add [Command-line-options](#options) | |
## To work on app ## To work on app