https://github.com/purarue/abook_parser
parser for the abook CLI
https://github.com/purarue/abook_parser
abook mutt neomutt
Last synced: 10 months ago
JSON representation
parser for the abook CLI
- Host: GitHub
- URL: https://github.com/purarue/abook_parser
- Owner: purarue
- License: mit
- Created: 2024-11-23T06:21:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T07:11:09.000Z (over 1 year ago)
- Last Synced: 2025-07-28T21:57:21.815Z (11 months ago)
- Topics: abook, mutt, neomutt
- Language: Python
- Homepage: https://pypi.org/project/abook-parser/
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# abook_parser
parser for the [abook](https://abook.sourceforge.io/) CLI
## Installation
Requires `python3.12+`
To install with pip, run:
```
pip install abook_parser
```
## Usage
This can read the addressbook, sort it by some key, and print a formatted version (either `JSON` or the `abook` addressbook format).
```
Usage: abook_parser parse [OPTIONS] FILE
Parse the addressbook file, and sort it by the name field
Options:
-t, --output-type [abook|json] output format type
-k, --sort-key TEXT sort addressbook items by key
-o, --output PATH output file path
--help Show this message and exit.
```
It also has commands to `add` or `edit` and item with a [`fzf`](https://github.com/junegunn/fzf)-based interactive mode.
```
Usage: abook_parser edit [OPTIONS] FILE
Edit a field in the addressbook file
Options:
--ignore-case / --no-ignore-case
ignore case in query
-q, --query TEXT query string to search for
--help Show this message and exit.
```
## Library Usage
The `abook_parser.parser.AbookFile` class can be used to interact with your addressbook file in code. Here are some of my scripts:
- [`abz`](https://purarue.xyz/d/abz?redirect) - [`fzf`](https://github.com/junegunn/fzf) based addressbook search script
- [`abook-populate`](https://github.com/purarue/HPI-personal/blob/master/scripts/abook-populate) - interactively prompts me to add new contacts to my addressbook by parsing my [locally stored Mail](https://github.com/purarue/HPI/blob/master/doc/MAIL_SETUP.md) and [SMS exports](https://github.com/karlicoss/HPI/blob/master/my/smscalls.py)
- [`birthdays`](https://purarue.xyz/d/birthdays?redirect) - lists upcoming birthdays from my addressbook
### Tests
```bash
git clone 'https://github.com/purarue/abook_parser'
cd ./abook_parser
pip install '.[testing]'
pytest
flake8 ./abook_parser
mypy ./abook_parser
```