Skip to content

V0.2.5#9

Merged
umpire274 merged 5 commits intomainfrom
v0.2.5
Oct 15, 2025
Merged

V0.2.5#9
umpire274 merged 5 commits intomainfrom
v0.2.5

Conversation

@umpire274
Copy link
Owner

[0.2.5] - Unreleased

Added

  • Backup command (librius backup)

    • Creates plain .sqlite backups in the backups/ directory
    • Optional --compress flag for compressed backups
      • .zip format on Windows
      • .tar.gz format on macOS and Linux
    • Localized help and messages via i18n (English and Italian)
    • Timestamp-based file naming for safe sequential backups
  • Export command (librius export)

    • Added support for exporting library data in multiple formats:
      • --csv (default): plain text export with semicolon delimiter
      • --json: structured JSON array output
      • --xlsx: formatted Excel file using umya-spreadsheet
    • Localized CLI help and status messages (English/Italian)
    • Automatic export directory and timestamped filenames
    • Uses dirs crate for cross-platform export path handling
  • Import command (librius import)

    • Supports importing book data from external sources
    • Available formats:
      • --csv (default): semicolon-delimited CSV
      • --json: JSON array of objects
    • Unified parsing via serde and shared BookRecord struct
    • Duplicate detection through unique index on isbn
    • Uses INSERT OR IGNORE for idempotent imports (no duplication)
    • Verbose mode logs skipped records (e.g., “Skipped duplicate ISBN: …”)
    • Non-blocking import completion logging

Database

  • Added migration PATCH_004_ISBN_INDEX:
    • Creates unique index on books.isbn to prevent duplicates
    • Automatically applied during startup migrations

Technical

  • Added dependency: csv = "1.3" for CSV import with serde
  • Unified SQL insert logic via insert_book_record() helper
  • Improved transaction safety and i18n message consistency

- Introduced new `backup` CLI command
- Supports plain backup (.sqlite) and compressed backup:
  - .zip on Windows
  - .tar.gz on macOS/Linux
- Added localized help and messages via i18n (en/it)
- Created backup files in ./backups/ with timestamped names
- Added OS-specific dependencies (zip, flate2, tar)
- Introduced new `export` CLI command with mutually exclusive format flags:
  --csv (default), --json, and --xlsx
- Implemented handlers:
  - handle_export_csv: plain text export with semicolon delimiter
  - handle_export_json: structured JSON array output
  - handle_export_xlsx: formatted Excel export using umya-spreadsheet
- Added localized help and success messages (en/it)
- Unified export file naming with timestamp and default export directory
- Ensured cross-platform path creation using dirs crate
- Implemented new `import` CLI command supporting:
  - `--file <path>` (required)
  - `--csv` (default) and `--json` subcommands
- Unified import logic for CSV and JSON using shared `BookRecord` struct (serde)
- Added helper function `insert_book_record()` to handle inserts safely
- Enabled `INSERT OR IGNORE` for idempotent imports (skip duplicate ISBNs)
- Added verbose logging for skipped records (e.g. "Skipped duplicate ISBN: …")
- Added non-blocking log write on import completion
- Updated i18n strings for new messages (en/it)
…ments

### Added
- New `backup` command:
  - Creates plain `.sqlite` backups
  - Optional `--compress` flag for `.zip` (Windows) or `.tar.gz` (Unix)
  - Timestamped filenames and localized output
- New `export` command:
  - Supports `--csv`, `--json`, and `--xlsx` output formats
  - Formatted Excel exports via umya-spreadsheet
  - Cross-platform export path management
- New `import` command:
  - Supports importing from CSV and JSON
  - Unified structure via `BookRecord`
  - Idempotent inserts using `INSERT OR IGNORE`
  - Verbose logging for skipped duplicates
- Database migration `PATCH_004_ISBN_INDEX`:
  - Adds unique index on `books.isbn` to prevent duplicate entries

### Technical
- Refactored insert logic into helper `insert_book_record()`
- Added non-blocking `write_log` calls in import/export
- Extended i18n coverage to new CLI commands and messages
- Updated README and CHANGELOG for release 0.2.5

Tag: `v0.2.5`
@umpire274 umpire274 merged commit 76399b1 into main Oct 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant