I've been closely watching for someone to start making ledger-cli bindings for Rust. I investigated doing it myself and reasoned that it would be a very large undertaking that would likely involve significant changes to the C++ code to accommodate the port. Most of the work would be around implementing a C-only interface to much of ledger-cli, then writing the bindings in Rust. This would probably be several dozen hours of work.
Frankly, it would seem "easier" to start ledger-cli in console mode as a background process. The Rust program would then feed it commands on its STDIN and parse the output on STDOUT. ledger-cli has an xml output mode but that's mostly for dumping resolved transaction data. You could probably make the output more parseable using the --display-format option crafted to output something that serde can parse easily (JSON, most likely). The quest for a good GUI for reporting led me to Scala-based Abandon initially, but I've since switched to ledger-cli + ledger2beancount + fava. On Sunday, April 29, 2018 at 9:45:18 AM UTC-4, adrian...@gmail.com wrote: > > I am trying to create a rust GTK ledger desktop app. I love ledger > simplicity and flexibility, and the fact that everything is stored in a > simple, readable text file. But I want to keep some reports and operations > handy, and I think a GTK desktop app will be perfect for that. > > I want to practise with Rust so I think this is a good opportunity for me. > The GTK rust app is progressing, but I haven't been successful on calling > ledger-cli from rust, since I want to use the original ledger-cli project > for maximum compatibility. People working with rust told me it would be > very difficult to create good bindings with a C++ app, and the only > alternative I have then is to embed the compiled ledger binary and call it > directly, but I wouldn't like to do that. > > Is there any good ledger-cli port to Rust? Or some good ledger-cli > bindings for Rust? I haven't been able to find any of those. > > Any advice on how to achieve this? Thanks a lot. > -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.