I did some more testing: - once you have the ~/.ledgerrc, a working directory .ledgerrc gets ignored - -i and --init-file have inconsistent behaviour (according to the documentation, it should be the same, but it is not)
$ cat ~/.ledgerrc --date-format %Y-%m-%d --sort date --effective --real $ ledger stats Error: No journal file was specified (please use -f) $ ledger -i .ledgerrc stats Error: No journal file was specified (please use -f) $ ledger --init-file .ledgerrc stats Time period: 2000-01-01 to 2023-10-24 (8697 days) Files these postings came from: < correct list of files here > Unique payees: 2273 Unique accounts: 96 Number of postings: 10191 (1.2 per day) Uncleared postings: 724 Days since last post: 1 Posts in last 7 days: 12 Posts in last 30 days: 65 Posts seen this month: 43 On Wednesday, October 25, 2023 at 11:24:41 AM UTC-4 lipp f wrote: > If I understand you correctly ~/.ledgerrc should never contain --file or > --include options, but only general options, and each project should be > contained in its own folder. I still have couple of questions: > - when I have an ~/.ledgerrc and another .ledgerrc in project folder, is > the second one loaded, assuming that working directory is project folder > when I invoke ledger? Which order? > - the documentation for include says "Include the stated file as if it > were part of the current file. The file name can contain a wildcard (‘*’) > to refer to multiple files (e.g. ‘bank/*.ledger’)" which is really useful. > Is there any way to specify the working directory in .ledger or to use > shell variables for include / file options? > > TIA. > On Tuesday, October 24, 2023 at 7:03:37 PM UTC-4 Enrico Lamperti wrote: > >> It's the expected behavior. Dotfiles in your home folder usually have >> global settings, so having more than one is a bad practice. >> >> You may have your common rules in it, and then in the directory where you >> have each ledger file (e.g. `~/work` and `~/personal`) you can have another >> `.ledgerrc` with specific settings for each project if you need. >> >> Also, instead of sourcing many files with `--file` you may use includes >> <https://ledger-cli.org/doc/ledger3.html#index-include> in a main ledger >> file, e.g.: >> >> include accounts.ledger >> include 2022.ledger >> include 2023.ledger >> include loans/friends.ledger >> >> Then you just have to specify this file with `--file` and all the others >> will be included as you want. >> >> This could even simplify your two `.ledgerrc` files down to a single one, >> because if you specify e.g. "--file main.ledger", I think it should work in >> both directories. >> >> >> On Sun, Oct 22, 2023 at 3:00 PM lipp f <[email protected]> wrote: >> >>> $ find ~ -name \*.ledgerrc >>> /home/<user>/.ledgerrc >>> /home/<user>/t14.ledgerrc >>> >>> The default one supposed to be for myself and t14 for my business. >>> Expecting to be completely separated. Each file has one or more --file >>> entry, no overlap. >>> >>> >>> $ ledger -i ~/t14.ledgerrc stats >>> and >>> $ ledger -i ~/.ledgerrc stats >>> >>> show actually only the default data, never the t14. >>> >>> I was expecting that whenever an init file is specified, the default one >>> wouldn't be used. Is this a bug? >>> >>> -- >>> >>> --- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ledger-cli/dd183690-c70b-45d4-a881-87080cf5c510n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/ledger-cli/dd183690-c70b-45d4-a881-87080cf5c510n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- --- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/7920deb2-b25e-4364-8b0e-c62a12a6bad9n%40googlegroups.com.
