https://github.com/jtmiclat/pre-commit-bean-format
Format beancount files using bean-format
https://github.com/jtmiclat/pre-commit-bean-format
beancount pre-commit
Last synced: 10 months ago
JSON representation
Format beancount files using bean-format
- Host: GitHub
- URL: https://github.com/jtmiclat/pre-commit-bean-format
- Owner: jtmiclat
- License: mit
- Created: 2023-11-30T01:37:12.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-02T06:09:15.000Z (over 2 years ago)
- Last Synced: 2025-07-07T14:59:32.105Z (12 months ago)
- Topics: beancount, pre-commit
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pre-commit-bean-format
Format `.beancount` files using [bean-format](https://beancount.github.io/docs/running_beancount_and_generating_reports.html#bean-format)
## Usage
Add this to your `.pre-commit-config.yaml`:
```yaml
- repo: https://github.com/jtmiclat/pre-commit-bean-format
rev: master # replace with commit sha
hooks:
- id: bean-format
```
This will run `bean-format` to all `.bean` and `.beancount` files
If you plan to use a different extension, you can pass a custom `files` using the files field.
For example, we have files with extension `.count`:
```yaml
- repo: https://github.com/jtmiclat/pre-commit-bean-format
rev: master # replace with commit sha
hooks:
- id: bean-format
files: \.count$
```
If you want to pin a certain version of `beancount` or other dependencies, you can add `additional_dependencies` field
For example, we want to pin `beancount` to certain version:
```yaml
- repo: https://github.com/jtmiclat/pre-commit-bean-format
rev: master # replace with commit sha
hooks:
- id: bean-format
additional_dependencies: ["beancount==2.3.6"]
```
If you want to pass additional arguments to format, you can add `args` field
For example:
```yaml
- repo: https://github.com/jtmiclat/pre-commit-bean-format
rev: master # replace with commit sha
hooks:
- id: bean-format
args: ["-w 100"]
```
# Credits
Forked from: https://github.com/whtsky/pre-commit-beancount-format/