# BibTeX Manager 📚

[![PyPI version](https://badge.fury.io/py/bibtex-manager.svg)](https://badge.fury.io/py/bibtex-manager)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A modern, terminal-based tool (TUI) to easily manage, clean, and deduplicate your `.bib` bibliography files. Built with [Textual](https://textual.textualize.io/).

## Features
- **TUI Interface**: Built with Textual for a modern terminal experience.
- **Deduplication**: Automatically find and merge duplicate entries using fuzzy matching.
- **Validation**: Identify incomplete entries missing critical fields (e.g., Title, Author, Year).
- **Customizable**: Resizable columns, persistent settings, and dark mode support.
- **History Tracking**: Undo and Redo actions easily.

## Screenshots


<p align="center">
  <img src="img/load_file.png" width="400" title="File Picker">
</p>

- **File Picker**: Built-in navigation to easily find and open your `.bib` files.

<p align="center">
  <img src="img/main_view.png" width="400" title="Main View">
</p>

- **Main View**: Displays all entries in your bibliography with customizable columns.

<p align="center">
  <img src="img/edit_entry.png" width="400" title="Edit Entry">
</p>

- **Edit Entry**: Simple modal for manually updating BibTeX fields.

<p align="center">
  <img src="img/duplicates_view.png" width="400" title="Duplicates View">
  <img src="img/resolve_duplicates.png" width="400" title="Merge Duplicates">
</p>

- **Duplicates View**: Groups potential duplicates with a similarity reason.
- **Merge Duplicates**: A dedicated interface to choose which entry to keep or delete within a duplicate group.

## Installation

You can install `bibtex-manager` directly via pip:

```bash
pip install bibtex-manager
```

Or install it locally from the source repository:

```bash
git clone https://github.com/RichardSrn/bibtex-manager.git
cd bibtex-manager
pip install .
```

## Usage

Simply run:

```bash
bibtex-manager
```

A file picker will guide you to select your `.bib` file (like the provided `example.bib`), or you can manually enter the path. 

Then, everything is done through the TUI. You can navigate using the keyboard shortcuts (press `?` to see them), or using the mouse.

## Configuration

Settings are saved in `~/.config/bibtex-manager/config.json`. You can modify the UI style, column sizes, and theme directly from within the application by clicking the **Settings** button.

## Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you'd like to contribute code, please fork the repository and submit a pull request.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## License

Distributed under the MIT License. See `LICENSE` for more information.
