hledger-flags
Parses hledger flags
> command: 'balance' file: 'ledger.journal' query: monthly: true
Parses flags for hledger. Knows most of hledger's flag aliases and other quirks.
API
OPTIONS
Options for rminimist
.
> OPTIONSboolean 'ignore-assertions' 'cleared' 'pending' ... > OPTIONSstring 'file' 'begin' 'end' ... > OPTIONSalias f: 'file' b: 'begin' e: 'end' ...
parse
parse(string)
Parses a string into a Ledger Flags object.
> command: 'balance' file: 'ledger.journal' query: monthly: true
The return value is an object that always has the following fields:
command
(String) - the command to be executedquery
(Array) - query to run
All other attributes are derived from the flags.
normalizeCommand
normalizeCommand(cmd)
Normalizes a command based on aliases.
> 'register' > 'balance'
toString
toString(flags)
Converts Ledger Flags back into string.
> args = ;> 'balance --file ledger.journal --monthly'
parseMany
parseMany(strings...)
Parses many arguments.
> args = ;> 'balance --file ledger.journal --monthly'
See also
- hledger.js - Node.js API for hledger.
- hledger-vis - hledger web UI built in Node.js.
Thanks
hledger-flags © 2016+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz