Minimalist plain text budgeting.
% npm i pbudget -g
% pbudget -s Budget.txt
% pbudget --stats Budget.txt
% cat Budget.txt | pbudget > Budget.txt
Groups start with = and are used to group values.
Flows start with + and are used to express cash flow.
Groups can be referenced in other groups or flows.
Multipliers can added to any referenced group or value.
Blocks of text with invalid syntax will be ignored and remain intact in the source.
Circular dependencies (group references) will cause both groups to be ignored.
Padding is automatically added to the value column.
|
Input
|
Output
|
import { readFileSync } from 'node:fs'
import { PlainBudget } from 'pbudget'
const budget = readFileSync('Budget.txt', 'utf8')
const pbudget = new PlainBudget(budget)
pbudget.process()
console.log(pbudget.renderWithPadding())
pbudget.computeStats()
console.log(pbudget.stats)