MyNixOS website logo
Description

A terminal UI as drop-in replacement for hledger add.

This is a terminal UI as drop-in replacement for hledger add.

It improves in the following ways on hledger's add command:

  • Interactive as-you-type completion for account names and descriptions with optional fuzzy matching.

  • Integrated calculator: Amounts can be written as simple sums with real-time feedback on the result.

  • All actions while entering a transaction can be undone

  • Configurable format for date input. Instead of y/m/d it is also possible to use other formats like the german d.m.y.

hledger-iadd

An interactive terminal UI as drop-in replacement for hledger add.

Screencast

Features

This project improves in the following ways on hledger's add command:

  • Interactive as-you-type completion for account names and descriptions with optional fuzzy matching (see below).

  • Integrated calculator: Amounts can be written as simple sums with real-time feedback on the result.

  • All actions while entering a transaction can be undone

  • Configurable format for date input. Instead of y/m/d it is also possible to use other formats like the german d.m.y.

Also see the user guide under Usage.

Installation

Latest release

Archlinux

For Archlinux users, an AUR package with a binary built by me (@hpdeifel) is available. If you want to compile hledger-iadd yourself, use one of the following installation methods.

stack

The easiest method would be [stack]: Install the [stack] program and type:

stack install --resolver=lts hledger-iadd-1.3.14

This downloads and builds hledger-iadd and all it's Haskell dependencies. After that, it copys the resulting binary to ~/.local/bin. See stack --help for more options. You may get asked to install the GHC Haskell compiler locally. To do that, type stack setup.

cabal

First, install the GHC Haskell compiler and the cabal install, alex and happy build tools, possibly from your distribution or the [haskell platform]. Type

cabal install --bindir ~/bin hledger-iadd

to install the binary in ~/bin.

Development version

To install the development version, clone the git repository first:

git clone https://github.com/hpdeifel/hledger-iadd.git
cd hledger-iadd

stack

The easiest method would be [stack]: Install the [stack] program and type:

stack install

To build and install all Haskell dependencies locally and install hledger-iadd to ~/.local/bin. See stack --help for more options. You may get asked to install the GHC Haskell compiler locally. To do that, type stack setup.

Cabal

First, install the GHC Haskell compiler and the cabal install, alex and happy build tools, possibly from your distribution or the [haskell platform].

Since cabal builds regularly break in non-isolated environments, the recommended next step is to create a cabal sandbox where all dependencies will be installed in:

cd hledger-iadd
cabal sandbox init

You can now download and install all dependencies locally with

cabal install --only-dependencies

And finally you're ready to build and install hledger-iadd:

cabal configure --bindir ~/bin
cabal build
cabal copy

Usage

YouTube video demonstrating basic interactions

You can start the program either with

hledger iadd

or simply hledger-iadd.

The following command line options are available:

  • -f/--file/: Path to the journal file. (Default: ~/.hledger.journal)
  • --date-format: Format for parsing dates. (Default: [[%y/]%m/]%d, the usual ledger date format). Brackets can be used to specify optional parts. E.g the german date format would be %d[.[%m[.[%y]]]]. (Dates are written as y/m/d to the journal regardless of this option).
  • --completion-engine: Algorithm for account name completion. Can be substrings or fuzzy.
  • --dump-default-config: Print the example config file to stdout and exit

The UI is partitioned in 4 regions:

Current Transaction (view of your work in progress)
---------------------------------------------------
Question: [ text area                             ]
---------------------------------------------------
Context information (e.g. list of accounts)




---------------------------------------------------
Message area

For each transaction, you will get asked the following questions in order:

  1. Date?
  2. Description?
  3. Account name?
  4. Amount?
  5. The last two questions are repeated until you enter the empty account
  6. Do you want to add this transaction to the journal?

To accept the default answer, immediately press Return at a promt.

While you type, the context area shows possible completions. Pressing Return answers the question with the currently selected completion. You can select differnt completions with C-n and C-p.

The following keyboard shortcuts are available:

KeyFunction
C-c, C-dQuit the program without saving the current transaction
EscAbort the current transaction or exit when at toplevel
RetAccept the currently selected answer
Alt-RetAccept the current answer verbatim from the text area, ignoring the selection
C-zUndo the last action
TabInsert the currently selected answer into the text area
C-n,Select the next context item
C-p,Select the previous context item
;Edit comment for current prompt
Alt-;Edit transaction comment
F1,Alt-?Show help dialog

Default Currency

To make entry easier it is recommended that you set a default commodity in your ledger file if you haven't already done so. That way when entering amounts, hledger-iadd will add the symbols for you. You can do this by adding a line like below to the top of your ledger file:

; sets the default commodity symbol and placement, thousands separator, and decimal symbol
D $1,000.00

Configuration File

hledger-iadd is optionally configurable through a configuration file in ${XDG_CONFIG_HOME}/hledger-iadd/config.conf. This file consists of simple

key = value

assignments on individual lines with whitespace or comments starting with # between them. The default config can be obtained by passing --dump-default-config to hledger-iadd.

The following options are currently available:

  • file: Path to the journal file.
  • date-format: The date format. See the documentation for --date-format for details.
  • completion-engine: Algorithm used to find completions for account names. Possible values are:
    • substrings: Every word in the search string has to occur somewhere in the account name
    • fuzzy: All letters from the search string have to appear in the name in the same order

License

The code of hledger-iadd is released under the [BSD3] license, but since hledger-lib -- the library that hledger-iadd uses -- is licensed under the [GPLv3], the terms of the GPL apply to the compiled and linked binary.

Metadata

Version

1.3.20

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows

Related (1)