announcing `pfr`

pfr is a command-line tool for helping me to manage my personal finances. It’s written in Rust. You can visit it here on GitHub or here on crates.io.

At the end of each month, I like to sit down and “allocate” funds to cover my expenses for the following month. However, not all of my expenses occur monthly. For example, things like rent are paid weekly, and I think of money spent on food in terms of weeks, so I have to multiply those expenses by 4 (ish). I also have to figure out how much money to put in each account, e.g on my EFTPOS (direct-debit) card or for automatic payments.

It’s not hard, but then again, that’s why we write programs.

We automate tasks not because they are hard, but because they are easy.
— JKF

You can tell pfr what your incomes and expenses are, and how often they occur, like so;

# I recieve $800 per month from part-time work.
pfr add income mthly work 800

# I spend $40 per week on food, and this comes out
# of my EFTPOS (direct-debit) bank account:
pfr add expense wkly food 40 --account "direct debit"

# Insurance for my car costs about $20 per month,
# and this comes out of my automatic payments bank account.
pfr add expense mthly "car insurance" 20 --account automatic --category car

# I fill up my car once a month, and this costs about
# $100, but this comes out of my EFTPOS account.
pfr add expense mthly petrol 100 --account "direct debit" --category car

And here’s what a report generated with pfr looks like:

$ pfr report
Monthly Report

INCOME              EXPENDITURE         VALUE       CATEGORY  ACCOUNT 
-----------------------------------------------------------------------
                    petrol              ( 100.00)   car       direct debit
work                                      800.00                      
                    car insurance       (  20.00)   car       automatic
                    food                ( 171.20)             direct debit
-----------------------------------------------------------------------
                    TOTAL:                508.80                      

Breakdown:
car              120.00
(other)          171.20

Coverage:
  20.00 -> automatic 
 271.20 -> direct debit
   0.00    (unallocated)

(Notice that the transactions that were added as “weekly” have been extrapolated out to a 30-day month, or about 4.3 weeks).

The report shows information about all of your transations in the table at the top, including whether they are an income or an expense, the value of the transaction, and, for expenses, the category and account that the expense is drawn from.

The next section, the Breakdown, shows your expenses broken down by category. In this case, we only have one category, car, and the remainder of the expenses don’t have an associated category.

The last section, Coverage, shows the value of funds that need to be moved into each account in order to cover the expenses for the month. In this case, you can see that you need to put $20.00 into your automatic account, and $271.20 into your direct debit account in order to cover your expenses for the month.

If you just want to see which transactions you’ve told pfr about, you can use pfr list;

$ pfr list
mthly   expense petrol                   100.00
mthly   expense car insurance             20.00
wkly    expense food                      40.00
mthly   income  work                     800.00

And thanks to structopt there’s also a handy-dandy help command;

$ pfr help
pfr 0.1.1
Antony Southworth <southworthy@gmail.com>
personal finance reporter.

USAGE:
    pfr <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    add       add a new entry.
    help      Prints this message or the help of the given subcommand(s)
    init      init the list of entries.
    list      list the current entries.
    report    generate a report for the month
    rm        remove an existing entry.

Feel like giving it a try?

cargo install pfr
pfr init

Or, if you’d like to take a look at the (brief) source code;

git clone https://github.com/KyussCaesar/pfr.git
Advertisement