From 272b6e6803fb01656180376f2b4ede17532b0924 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Fri, 4 Dec 2015 09:48:43 +0800 Subject: [PATCH] Update ledger stuff --- hledger.md | 120 +++++++++++++++++++++++++++++++++++++++++++++++ ledger-format.md | 64 +++++++++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 hledger.md create mode 100644 ledger-format.md diff --git a/hledger.md b/hledger.md new file mode 100644 index 00000000..553f360a --- /dev/null +++ b/hledger.md @@ -0,0 +1,120 @@ +--- +title: Hledger +category: Ledger +--- + +### Accounts + +``` +hledger accounts +hledger accounts --tree +``` + +## Reporting + +``` +hledger {bal|reg} {interval} {range} {query} +``` + +### Query + +``` +Assets ; An account +^Assets ; Starting with Assets +acct:Assets ; account by regex +inacct:'A:B' ; transactions related to account + +acctonly:A ; no subaccounts +inacctonly:A ; same, but no subaccounts + +amt:2000 ; amount (in absolute value) +amt:<200 ; amount comparison (in absolute value) +amt:<+200 ; amount comparison + ; also: <=, >, >= + +desc:REGEX + +code:REGEX +cur:'\$' +depth:N ; --depth 2 +tag:REGEX +not:... +``` + +``` +real:1 ; -R, --real, no virtuals +status:! ; --pending +status:* ; -C, --cleared +status: ; --uncleared +``` + +### Intervals + +``` +-D, --daily +-W, --weekly +-M, --monthly +-Q, --quarterly +-Y, --yearly +``` + +### Range + +``` +-p, --period=... +date:2015/01/01 +date:2015/01/01- ; -b, --begin +date:-2015/01/01 ; -e, --end +date2:PERIODEXPR +``` + +### Periods + +``` + -p, --period=... + + -p "2009/01/01" + -p "2009/01/01 to 2009/12/31" + -p "2009/01/01to2009/12/31" ; spaces optional + -p "1/1 to 12/31" + -p "to 2009" + -p "weekly" + -p "weekly 2009/01/01 to 2009/12/31" +``` + +## Balance + +When used with intervals (like `--weekly`): +``` +--cumulative # show ending balance per period +--historical # like --cumulative but only for --begin +``` + +``` +--tree +``` + +### Format + +``` +--format "%20(account) %12(total) +``` + +## Register + + +## Querying + +``` +acct:REGEX +amt:N +amt:, >=) +code:REGEX +cur:'\$' +desc:REGEX +date:PERIODEXPR +date2:PERIODEXPR +depth:N +tag:REGEX +not: +``` diff --git a/ledger-format.md b/ledger-format.md new file mode 100644 index 00000000..b30e91f2 --- /dev/null +++ b/ledger-format.md @@ -0,0 +1,64 @@ +--- +title: Ledger format +category: Ledger +--- + +``` +2015/01/01 Pay rent + Assets:Savings -$300 + Expenses:Rent +``` + +### First line + +``` +2015/01/01 * Pay rent ; tagname: +^ ^ ^ +Date Flag Description ^ comment/tag +``` + +### Balance assertion + +``` +2015/01/01 Pay rent + Assets:Savings -$300 = $1200 ; assert there's $1200 left after + Expenses:Rent +``` +Flags: + +``` +* cleared +! pending +``` + +## Accounts +Only relevant with `--strict` or `--pedantic` + +``` +account Expenses:Food + note This account is all about the chicken! + alias food + payee ^(KFC|Popeyes)$ + check commodity == "$" + assert commodity == "$" + eval print("Hello!") + default +``` + +## Others + +``` +D $1,000.00 ; set default commodity + +alias Cash = Assets:Cash + +Y2015 ; set default year (you can use 01/25 as date after) +``` + +### Prefix all transactions with an account + +``` +account Home +include home.journal +end +```