spbi is a CLI application written in C for splitting bills easily.
Simply clone the project, then build and optionally install the executable using make.
git clone https://github.com/sorousherafat/spbi.git
cd spbi/
make
sudo make installImportant
Before running spbi, please ensure that both cpp (the C preprocessor) and column are installed and available on your PATH. Both are usually available by default on a UNIX machine.
spbi takes a single argument: the path to an input file. It reads this file, processes its content, and outputs the result to the standard output.
The input file should contain a series of statements in the following format:
<person> += <amount> : <people>
<person>: The identifier of the individual who has loaned money.<amount>: A number or a more complex expression representing the loaned amount.<people>: A list of recipients. This list is defined by identifiers separated by the+and-operators. The+operator includes a person in the split, while the-operator excludes them, if they are included on the list.
For example:
alice += 100 * 2 : bob + charlie + dave - dave
indicates that alice has loaned an amount of 100 which will be split equally among bob and charlie (with dave excluded).
count: A builtin function that takes a list of people as input and returns the number of people. This can be useful for multiplying a single fee by the number of recipients.
Before processing, spbi runs the C preprocessor (cpp) on the input file. This allows you to write macros for more powerful expressions. For instance, you might define:
#define all a + b + cAfter which, using all - c in your file will represent the list consisting of a and b.
This project is licensed under the GPL-3.0 license.