| Crates.io | librius |
| lib.rs | librius |
| version | 0.5.1 |
| created_at | 2025-10-12 21:09:33.825928+00 |
| updated_at | 2025-11-12 22:42:59.861879+00 |
| description | A personal library manager CLI written in Rust. |
| homepage | https://github.com/umpire274/librius |
| repository | https://github.com/umpire274/librius |
| max_upload_size | |
| id | 1879703 |
| size | 1,578,629 |
Librius โ A fast, minimalist CLI to manage your personal book collection, built in Rust.
Librius is a cross-platform command-line tool written in Rust that helps you manage your personal library.
It uses a SQLite database to store your books and a simple YAML configuration file
(librius.conf) for flexible setup.
This project aims to provide a clean, modular architecture with future extensions such as search, add/remove commands, and import/export support.
๐๏ธ Database management command
A brand new db command has been introduced for complete database lifecycle control:
librius db --init
Initializes or resets the current database.
librius db --reset
Alias of --init.
librius db --copy -f|--file <NEW_FILE>
Copies the database defined in your librius.yaml configuration to a new file.
The database path is automatically read from the database: key in the configuration file.
๐ Improved list details view
-compact flag for list --id <ID> --details to hide empty fields in the vertical table.--compact flag now requires --details, ensuring consistent CLI behavior.String; now they correctly show localized Field / Value columns.id โ added_at).๐ Fixes & improvements
--copy flag incorrectly requiring a value.yay -S librius
# or
paru -S librius
brew tap umpire274/tap
brew install librius
cargo install rtimelogger
| Feature | Command | Description |
|---|---|---|
| List | librius list |
Display all books stored in the local database, in full or compact view |
| Search | librius search <query> |
Full-text search across title, author, editor, genre, and language fields; supports --short for compact view |
| Add book | librius add book --isbn <ISBN> |
Add new books using ISBN lookup via Google Books API |
| Edit book | librius edit book <ID/ISBN> |
Edit existing records by ID or ISBN; dynamic field generation, language conversion, and plural-aware messages |
| Delete book | del <ID/ISBN> |
Delete books by ID or ISBN, with interactive confirmation, --force flag, and logged deletions |
| Config management | librius config |
Manage YAML configuration via --print, --init, --edit, --editor |
| Database management | librius db |
DB Management via --init, --reset, --copy -f|--file <name new file> |
| Backup | librius backup |
Create plain or compressed database backups (.sqlite, .zip, .tar.gz) |
| Export | librius export |
Export data in CSV, JSON, or XLSX format |
| Import | librius import |
Import data from CSV or JSON files (duplicate-safe via ISBN) |
| Database migrations | (automatic) | Automatic schema upgrades and integrity checks at startup |
| Logging system | (internal) | Records all operations and migrations in an internal log table |
| Multilanguage (i18n) | librius --lang <code> |
Fully localized CLI (commands, help, messages); --lang flag and config key |
| Dynamic help system | librius help <command> |
Ordered and grouped help output using display_order() and next_help_heading() |
List all books or a specific book by ID.
$ librius list [--short] [--id <ID>] [--details] [--compact]
Options:
--short Compact view--id Show book by ID--details Show extended metadata (requires --id)--compact Compact list view (requires --details)--help Show command helpSearch for books by title, author, editor, genre, or language.
$ librius search <query> [--short]
Options:
--short Show compact view (ID, Title, Author, Editor, Year, ISBN)<query> Search term--help Show command helpAdd a new book using its ISBN.
$ librius add book --isbn <ISBN>
Options:
--isbn <ISBN> ISBN of the book to add--help Show command helpEdit an existing book by ID or ISBN.
$ librius edit book <ID/ISBN> [--title <TITLE>] [--author <AUTHOR>] [--editor <EDITOR>] [--year <YEAR>] [--genre <GENRE>] [--language <LANGUAGE>] [--isbn <ISBN>]
Options:
<ID/ISBN> ID or ISBN of the book to edit--title <TITLE> New title--author <AUTHOR> New author--editor <EDITOR> New editor--year <YEAR> New publication year--genre <GENRE> New genre--language <LANGUAGE> New language--isbn <ISBN> New ISBN--help Show command helpDelete a book by ID or ISBN.
$ librius del <ID/ISBN> [--force]
Options:
<ID/ISBN> ID or ISBN of the book to delete--force Skip confirmation prompt--help Show command helpManage application configuration.
$ librius config [--print] [--init] [--edit] [--editor <EDITOR>]
Options:
--print Print current configuration--init Create default config file--edit Open config file in editor--editor <EDITOR> Specify editor (default: $EDITOR or nano--help Show command helpManage the Librius database lifecycle and backups.
librius db [--init] [--reset] [--copy -f|--file <NEW_FILE>]
Options:
--init Initialize a new database--reset Reset the database (deletes all data)--copy -f|--file <NEW_FILE> Copy the database to a new file--help Show command helpCreate a backup of the database.
$ librius backup [--compress]
Options:
--compress Create a compressed backup (.zip or .tar.gz)--help Show command helpExport library data to CSV, JSON, or XLSX.
$ librius export [--csv | --json | --xlsx] [-o|--output <FILE>]
Options:
--csv Export as CSV (default)--json Export as JSON--xlsx Export as XLSX-o, --output <FILE> Specify output file path--help Show command helpImport library data from CSV or JSON.
$ librius import --file <FILE> [--json] [--csv] [-d|--delimiter <CHAR>]
Options:
--file <FILE> Path to input file--json Specify if the input file is JSON (default is CSV)--csv Specify if the input file is CSV-d, --delimiter <CHAR> Specify CSV delimiter (default: ,)--help Show command helpLibrius now supports a multilingual interface.
| Source | Description |
|---|---|
| ๐ฌ๐ง en.json | Default English messages |
| ๐ฎ๐น it.json | Italian translation |
| ๐ README.md | Located in src/i18n/locales/, describes key naming conventions |
# Default (English)
librius list
# Force Italian interface
librius --lang it list
librius.conf)# librius.conf
database: "C:/Users/YourName/AppData/Roaming/librius/librius.sqlite"
language: "it" # Set default language to Italian
All translations are stored in:
src/i18n/locales/
โโโ en.json
โโโ it.json
โโโ README.md
Each .json file contains keyโvalue pairs like:
{
"app.config.loading": "Loading configuration...",
"db.init.ok": "Database created successfully.",
"book.add.ok": "Book '{title}' added successfully!"
}
Variables can be inserted at runtime:
tr_with!("db.path.open_existing", & [("path", & db_path)]);
src/
โโ main.rs
โโ lib.rs
โโ cli.rs
โ
โโ commands/
โ โโ mod.rs
โ โโ list.rs
โ โโ backup.rs
โ โโ config.rs
โ โโ export.rs
โ โโ import.rs
โ
โโ config/
โ โโ mod.rs
โ โโ load_config.rs
โ โโ migrate_config.rs
โ
โโ db/
โ โโ mod.rs
โ โโ load_db.rs
โ โโ migrate_db.rs
โ
โโ i18n/
โ โโ mod.rs
โ โโ loader.rs
โ โโ locales/
โ โโ en.json
โ โโ it.json
โ โโ README.md
โ
โโ models/
โ โโ mod.rs
โ โโ book.rs
โ
โโ utils/
โโ mod.rs
โโ table.rs
See CHANGELOG.md for a detailed list of changes and updates.
Librius now supports full data import/export functionality.
You can export your library to multiple formats:
librius export --csv # CSV (default)
librius export --json # JSON
librius export --xlsx # Excel (XLSX)
Exports are automatically saved in your user data directory
(e.g. ~/.config/librius/exports or %APPDATA%\librius\exports).
Import books from CSV or JSON files:
librius import --file examples/books.csv
librius import --file examples/books.json --json
Features:
isbnExample output:
๐ Skipped duplicate ISBN: 978-0-345-33968-3
โ
Imported 6 records from CSV file.
git clone https://github.com/umpire274/librius.git
cd librius
cargo build
cargo run -- list
If this is the first launch, Librius will automatically create:
~/.config/librius/librius.conf~/.config/librius/librius.sqlite$ librius list
๐ Your Library
# librius.conf
database: "C:/Users/YourName/AppData/Roaming/librius/librius.sqlite"
language: "en"
Librius now follows a standard Rust modular structure:
use librius::{build_cli, handle_list, tr};
The API and user-facing documentation for Librius is available on docs.rs:
To generate and view the documentation locally run:
cargo doc --no-deps --open
This will build the documentation and open it in your default browser.
Librius automatically verifies and upgrades the SQLite database schema at startup.
The latest migration adds a unique index on isbn to guarantee
that duplicate imports are ignored safely.
CREATE UNIQUE INDEX IF NOT EXISTS idx_books_isbn ON books (isbn);
Each migration patch (PATCH_001, PATCH_002, โฆ) is applied once and recorded in the internal log table.
The process is fully idempotent โ no duplicate operations are ever performed.
๐ Applying database patch: PATCH_002
โ
All pending migrations applied.
โ
Database schema is up-to-date.
log| id | date | operation | target | message |
|---|---|---|---|---|
| 1 | 2025-10-13T21:45:12+02:00 | DB_CREATED | DB | Created new database |
| 2 | 2025-10-13T21:45:13+02:00 | DB_MIGRATION_OK | DB | Schema updated successfully |
๐ Verbose mode
Run Librius in diagnostic mode to display all internal initialization steps:
librius --verbose list
Output example:
๐ Loading configuration...
๐ Opening existing database at: C:\Users\A.Maestri\AppData\Roaming\librius\librius.db
โ
Database schema is up-to-date.
โ
Configuration verified.
๐ Your Library
In normal mode, only command output is displayed.
cargo run -- list
RUST_LOG=debug cargo run -- add "Neuromancer"
cargo fmt
cargo clippy
add, remove, and search commandsratatuiUmpire274 GitHub: @umpire274
This project is licensed under the MIT License โ see the LICENSE
Contributions, feature requests, and ideas are welcome! If youโd like to contribute, please open a pull request or start a discussion.
If you enjoy this project, please โญ star the repository โ it helps visibility and development motivation!