{"id":13541184,"url":"https://github.com/jcornaz/nu_plugin_from_beancount","last_synced_at":"2025-04-02T08:30:59.096Z","repository":{"id":65809020,"uuid":"597443770","full_name":"jcornaz/nu_plugin_from_beancount","owner":"jcornaz","description":"A nushell extension to load a beancount file into nu structured data","archived":true,"fork":false,"pushed_at":"2023-12-10T14:41:04.000Z","size":176,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T08:04:06.942Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcornaz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-02-04T15:16:11.000Z","updated_at":"2025-02-15T22:08:43.000Z","dependencies_parsed_at":"2023-12-10T14:30:59.919Z","dependency_job_id":"cd066e8b-4e0a-4281-8997-a06f9666f3da","html_url":"https://github.com/jcornaz/nu_plugin_from_beancount","commit_stats":{"total_commits":76,"total_committers":4,"mean_commits":19.0,"dds":0.3157894736842105,"last_synced_commit":"0fe1d872147f39586dc2be4c4734ae10ce10a1e8"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcornaz%2Fnu_plugin_from_beancount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcornaz%2Fnu_plugin_from_beancount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcornaz%2Fnu_plugin_from_beancount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcornaz%2Fnu_plugin_from_beancount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcornaz","download_url":"https://codeload.github.com/jcornaz/nu_plugin_from_beancount/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246781940,"owners_count":20832937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T10:00:40.668Z","updated_at":"2025-04-02T08:30:58.803Z","avatar_url":"https://github.com/jcornaz.png","language":"Rust","funding_links":[],"categories":["Plugins"],"sub_categories":[],"readme":"# nu_plugin_from_beancount\n\n[![License](https://img.shields.io/crates/l/nu_plugin_from_beancount)](#Unlicense)\n[![Crates.io](https://img.shields.io/crates/v/nu_plugin_from_beancount)](https://crates.io/crates/nu_plugin_from_beancount)\n![rustc](https://img.shields.io/badge/rustc-1.67+-blue?logo=rust)\n\nA [nushell] extension convert [beancount] file into nu structured data.\n\nWhen using [nushell] one could run `bean-example | from beancount` or `open my-ledger.beancount` to get a nushell structured\ntable that can be further transformed and manipulated.\n\n[nushell]: https://www.nushell.sh/\n[beancount]: https://beancount.github.io/docs/index.html\n\n\n## Example\n\n```nu\n\u003e bean-example | from beancount | where direcive == txn | take 1\n╭───┬─────────────┬───────────┬──────┬───────┬──────────────────────────────────────┬────────────────────────────────────────────────────╮\n│ # │    date     │ directive │ flag │ payee │              narration               │                      postings                      │\n├───┼─────────────┼───────────┼──────┼───────┼──────────────────────────────────────┼────────────────────────────────────────────────────┤\n│ 0 │ 2 years ago │ txn       │ *    │       │ Opening Balance for checking account │ ╭───┬─────────────────────────┬──────────────────╮ │\n│   │             │           │      │       │                                      │ │ # │         account         │      amount      │ │\n│   │             │           │      │       │                                      │ ├───┼─────────────────────────┼──────────────────┤ │\n│   │             │           │      │       │                                      │ │ 0 │ Assets:US:BofA:Checking │ ╭───┬─────────╮  │ │\n│   │             │           │      │       │                                      │ │   │                         │ │ # │   USD   │  │ │\n│   │             │           │      │       │                                      │ │   │                         │ ├───┼─────────┤  │ │\n│   │             │           │      │       │                                      │ │   │                         │ │ 0 │ 4560.14 │  │ │\n│   │             │           │      │       │                                      │ │   │                         │ ╰───┴─────────╯  │ │\n│   │             │           │      │       │                                      │ │ 1 │ Equity:Opening-Balances │ ╭───┬──────────╮ │ │\n│   │             │           │      │       │                                      │ │   │                         │ │ # │   USD    │ │ │\n│   │             │           │      │       │                                      │ │   │                         │ ├───┼──────────┤ │ │\n│   │             │           │      │       │                                      │ │   │                         │ │ 0 │ -4560.14 │ │ │\n│   │             │           │      │       │                                      │ │   │                         │ ╰───┴──────────╯ │ │\n│   │             │           │      │       │                                      │ ╰───┴─────────────────────────┴──────────────────╯ │\n╰───┴─────────────┴───────────┴──────┴───────┴──────────────────────────────────────┴────────────────────────────────────────────────────╯\n```\n\n\n## Supported Beancount syntax\n\n* [x] Transaction\n  * [x] Postings\n    * [x] Account\n    * [x] Amount\n    * [ ] Cost\n* [x] Include directive\n* [ ] Pad directive\n* [x] Balance assertion\n* [ ] Option\n* [ ] ...\n\n\n## Installation\n\n```nu\ncargo install nu_plugin_from_beancount\nregister ~/.cargo/bin/nu_plugin_from_beancount\n```\n\n## Companion scripts\n\nCurrently, this plugin is intentionally quite dumb and does nothing more than outputing the beancount file content without any transformation or resolution.\nBut for most ledgers, the content of the file does not contain all informations required for further analysis.\nFor example, the transactions are often not explicitely balanced (one posting has no explicit amount), making it hard to make any useful aggregation of the amounts.\n\nHere are some \"companion\" scripts that you may find useful when working with `from beancount`.\n\n\u003e **Note**\n\u003e Those scripts are provided here as a suggestion. They are not thoroughy tested, and are not considered part of the plugin API.\n\n```nu\n# Negate a structured amount (which is a record of currencies to values)\ndef \"bean amount neg\" [] {\n  transpose currency value | update value { -($in.value) } | transpose -ird\n}\n\n# Complete transactions that are not explitly balanced, so that all transactions balance\ndef \"bean resolve txn\" [] {\n  each {|row|\n    if $row.directive != \"txn\" { $row } else {\n      let offset_accounts = ($row.postings | where amount == $nothing | get -i account)\n      if ($offset_accounts | is-empty) { $row } else {\n        let complete_postings = ($row.postings | where amount != $nothing)\n        let offset_account = ($offset_accounts | first)\n        let offset_amount = ($complete_postings | get amount | math sum | bean amount neg)\n        $row | update postings ($complete_postings | append {account: $offset_account, amount: $offset_amount})\n      }\n    }\n  }\n}\n```\n\n\n## Unlicense\n\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n\nIn jurisdictions that recognize copyright laws, the author or authors\nof this software dedicate any and all copyright interest in the\nsoftware to the public domain. We make this dedication for the benefit\nof the public at large and to the detriment of our heirs and\nsuccessors. We intend this dedication to be an overt act of\nrelinquishment in perpetuity of all present and future rights to this\nsoftware under copyright law.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\nFor more information, please refer to \u003chttp://unlicense.org/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcornaz%2Fnu_plugin_from_beancount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcornaz%2Fnu_plugin_from_beancount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcornaz%2Fnu_plugin_from_beancount/lists"}