hledger -is:package

This is the root of the hledger-lib package and the Hledger.* module hierarchy. hledger-lib is the core engine used by various hledger UIs and tools, providing the main data types, file format parsers, reporting logic, and utilities. SPDX-License-Identifier: GPL-3.0-or-later Copyright (c) 2007-2025 (each year in this range) Simon Michael simon@joyful.com and contributors. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Build a cmdarg mode for a hledger command, from a help template and flag/argument specifications. Reduces boilerplate a little, though the complicated cmdargs flag and argument specs are still required.
Run hledger-web's built-in tests using the hspec test runner.
Custom error data for hledger parsers. Specialised for a Text parse stream. ReparseableTextParseErrorData ?
A specialised version of ParseErrorBundle: a non-empty collection of hledger parse errors, equipped with PosState to help pretty-print them. Specialised for a Text parse stream.
The name and package version of a hledger binary, and the build's git hash, the release date, and the binary's intended operating machine and machine architecture, if we can detect these. Also, a copy of the --version output from which it was parsed.
A hledger version string, as shown by hledger --version. This can vary; some examples:
  • dev builds: hledger 1.42.99-g2288f5193-20250422, mac-aarch64
  • release builds: hledger 1.42.1, mac-aarch64
  • older versions: hledger 1.21
Make classy lenses for Hledger options fields. This is intended to be used with BalancingOpts, InputOpt, ReportOpts, ReportSpec, and CliOpts. When run on X, it will create a typeclass named HasX (except for ReportOpts, which will be named HasReportOptsNoUpdate) containing all the lenses for that type. If the field name starts with an underscore, the lens name will be created by stripping the underscore from the front on the name. If the field name ends with an underscore, the field name ends with an underscore, the lens name will be mostly created by stripping the underscore, but a few names for which this would create too many conflicts instead have a second underscore appended. ReportOpts fields for which updating them requires updating the query in ReportSpec are instead names by dropping the trailing underscore and appending NoUpdate to the name, e.g. querystring_ -> querystringNoUpdate. There are a few reasons for the complicated rules. - We have some legacy field names ending in an underscore (e.g. value_) which we want to temporarily accommodate, before eventually switching to a more modern style (e.g. _rsReportOpts) - Certain fields in ReportOpts need to update the enclosing ReportSpec when they are updated, and it is a common programming error to forget to do this. We append NoUpdate to those lenses which will not update the enclosing field, and reserve the shorter name for manually define lenses (or at least something lens-like) which will update the ReportSpec. cf. the lengthy discussion here and in surrounding comments: https://github.com/simonmichael/hledger/pull/1545#issuecomment-881974554
A helper for addon commands: this parses options and arguments from the current command line using the given hledger-style cmdargs mode, and returns a CliOpts. Or, with --help or -h present, it prints long or short help, and exits the program. When --debug is present, also prints some debug output. Note this is not used by the main hledger executable. The help texts are generated from the mode. Long help includes the full usage description generated by cmdargs (including all supported options), framed by whatever pre- and postamble text the mode specifies. It's intended that this forms a complete help document or manual. Short help is a truncated version of the above: the preamble and the first part of the usage, up to the first line containing "flags:" (normally this marks the start of the common hledger flags); plus a mention of --help and the (presumed supported) common hledger options not displayed. Tips: Empty lines in the pre/postamble are removed by cmdargs; add a space character to preserve them.
Parse hledger's --version output.
>>> isRight $ parseHledgerVersion "hledger 1.21"
True

>>> isRight $ parseHledgerVersion "hledger 1.42.1, mac-aarch64"
True

>>> isRight $ parseHledgerVersion "hledger 1.42.99-g2288f5193-20250422, mac-aarch64"
True