Keep track of your piggy bank.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Alexander Andreev ec419ec9c6 Oh, just noticed that comment. Cleaned up! 3 months ago
piggybank :) 3 months ago
.gitignore Performed some refactoring on an existing code base before further work. 7 months ago
COPYING I changed the license from WTFPLv2 to MIT. 4 months ago
Makefile Fixed all the shit I broke. ;) 3 months ago
README.md And a little formatting... 3 months ago
pyproject.toml --user flag added in Makefile. Added a pyproject.toml file. setup.cfg fixed. 4 months ago
setup.cfg Oh, just noticed that comment. Cleaned up! 3 months ago
setup.py Initial commit adding everything that consists the project. 10 months ago

README.md

Keep track of your piggy bank.

Every time you put coins in or take them out of your piggy bank, write here down how much did you put or take. So you won’t have to spend time counting them when you decide to take them all out.

Yes, only coins, no banknots. Well, you actually can easily add them, but table will become indeed wide.

Usage

piggybank [OPTIONS] (COINS in FILE [of CURRENCY] | COINS from FILE | show FILE [with t(ransactions)])

Common options:

  • -h,--help — print this help;
  • -v,--version — print program version;
  • -L,--list-currencies — list supported currencies and a default one;

Brief usage with examples

Put coins in

piggybank [-r | --reversed] COINS in FILE [of CURRENCY]
piggybank -r 1 4 5 4 6 8 in example.pb of SRUB

Take coins out

piggybank [-r | --reversed] COINS from FILE
piggybank -r 5 4 6 from example.pb

Show information on your piggy bank

piggybank show FILE [with t(ransactions)]
piggybank show example.pb with t

How to put coins in

piggybank [-r | --reversed] COINS in FILE [of CURRENCY]

--reversed flag reverses the order of coins. By default they come from least significant face value to the most significant one and being complemented from left so a set shorter than number of coins in a currency, e.g. 5 8 4 will be interpreted as 0 0 0 5 8 4. And this flag will make it to be interpreted as 5 8 4 0 0 0. It is convenient if you want to add only coins of low face value (e.g. cents).

COINS is a set of coins’ counts separated with space or comma character. For example: 0 5 0 4 6 7. By default trailing zeroes will be added from the left. So if you wrote something like 6 0 5 12 then it will be complemented to 0 0 6 0 5 12 if currency has 6 coins.

FILE is a name of a piggy bank file wich may not have a .pb extension at the end, it will be added automatically.

CURRENCY specifies the currency of a new piggy bank. It will not change currency of an existing piggy bank. ISO standard is used, e.g. EUR. Case-insensitive.

Examples:

piggybank 7 4 3 0 5 in example.pb of EUR
piggybank -r 0 4 6 in example

How to take coins out

piggybank [-r | --reversed] COINS from FILE

All the parameters are explained above.

Examples:

piggybank -r 0 0 4 from example.pb

How to see what you have in there

piggybank show FILE [with t(ransactions)]

It will print a summary table of what is stored in a piggy bank.

with t(ransactions) will print also a table of all transactions stored in a file.

Examples:

piggybank show example.pb with t

Configuration

Configuration file piggybank.conf is stored in directory specified by $XDG_CONFIG_HOME environment variable or, if it isn’t set, in $HOME/.config (which is exactly where $XDG_CONFIG_HOME points to) on Linux. On Windows it is stored right in %APPDATA%.

Currently there are two options:

  • default-currency sets default currency used for new piggy banks. Its default value is SRUB.
  • currency.<ISO> defines a currency. By default there are: RUB, SRUB (has no coins of 1 and 5 kopek since they are extremely rare now), BYN, UAH, USD, EUR and GBP.

Options are simple key=value storage. Spaces between = symbol are necessary.

Currency is defined following way:

currency.<ISO> = <ISO>;<CURRENCY NAME>;<COINS COUNT>;{}<FRACTION SYMBOL>,{}<CURRENCY SYMBOL>;<FACE VALUES>

That is best described with an example. Here it is:

currency.EXM = EXM;Example;6;{}c,{}E;5,10,25,50,100,200