Code Monkey home page Code Monkey logo

Comments (4)

apauley avatar apauley commented on June 1, 2024

Interesting use case - I haven't yet used auto postings. I'd like to add some to my personal journals so that I can run into the same issues you're describing.

The next week or two will be difficult though - but you're welcome to remind me about this if you haven't seen any activity in a few weeks.

from hledger-flow.

lestephane avatar lestephane commented on June 1, 2024

I don't use autopostings much yet, but seeing the effects of my changes in journals would allow me to experiment much more with them.

from hledger-flow.

lestephane avatar lestephane commented on June 1, 2024

This is not urgent

from hledger-flow.

lestephane avatar lestephane commented on June 1, 2024

I have the following (working) workaround

First, make it possible to override the hledger command in the scope of my root import directory

(in the root import directory)
$ cat .envrc 
PATH_add $(expand_path .)

Then, override the hledger command in such a way that hledger-flow picks it up

$ cat hledger
#!/usr/bin/env bash

MYDIR=$(readlink -e $(dirname "$0"))

set -euxo pipefail

case $@ in
    print\ *--file\ -*)
        cat "${MYDIR}/explicit-autopostings.journal" - | "${HOME}/.local/bin/hledger" "$@" --auto
    ;;
    --version|--help)
        "${HOME}/.local/bin/hledger" "$@"
    ;;
    print\ --forecast*)
        "${HOME}/.local/bin/hledger" "$@"
    ;;
    print\ --rules-file*)
        "${HOME}/.local/bin/hledger" "$@"
    ;;
    *)
        echo "unhandled: " "$@" 1>&2
        exit 1
    ;;
esac

A few notes:

  • The rewrite rules are in the shared explicit-autopostings.journal file, which itself is not
    !include-d anywhere else
  • Adding an extra -f explicit-autopostings.journal command line argument did not work.
    Instead, I add to pipe the autopostings to the hledger command in addition to the original input,
    hence the cat "${MYDIR}/explicit-autopostings.journal" -
  • There is an additional --auto argument added to generate the automated postings.

As a result, my 3-journal target directories now contain the automated postings, and I can see the effect of my changes to rewrite rules in all their glory / infamy. I've got regressions on almost all the automated postings, so it was well worth adding.

from hledger-flow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.