README.md updated. Added name of config file. To be thinked on how to implement configuration. There's only one option to store, but I want to come up with solution suitable to use in future.
This commit is contained in:
parent
684bb1a457
commit
fc15b333b7
39
README.md
39
README.md
@ -1,13 +1,22 @@
|
|||||||
Keep track of your piggy bank.
|
Keep track of your piggy bank.
|
||||||
|
|
||||||
|
|
||||||
Every time you put coins in or take them out of your piggy bank, write here down
|
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 to count them when
|
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.
|
you decide to take them all out.
|
||||||
|
|
||||||
Yes, only coins, no banknots. Well, you actually can easily add support for
|
Yes, only coins, no banknots. Well, you actually can easily add support for
|
||||||
banknots, but table will become indeed wide.
|
banknots, but table will become indeed wide.
|
||||||
|
|
||||||
|
# Backstory
|
||||||
|
|
||||||
|
Many years ago I wrote a little script to store info on how much coins I have
|
||||||
|
in my piggy bank. It used SQLite 3 database for it and was hardcoded to rubles.
|
||||||
|
|
||||||
|
This year I came up with an idea that it would be good to learn on how to make
|
||||||
|
packages for Python. And with no better ideas I took my piggy bank script to be
|
||||||
|
rewritten to support any currency. Database was thrown away and its place was
|
||||||
|
took by a simple text format.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
This is a CLI program that is broken down to three separate programs:
|
This is a CLI program that is broken down to three separate programs:
|
||||||
@ -24,9 +33,11 @@ optionally, print a list of transactions.
|
|||||||
piggybank-* [(-h | --help) | (-v | --version) | --list-currencies]
|
piggybank-* [(-h | --help) | (-v | --version) | --list-currencies]
|
||||||
```
|
```
|
||||||
|
|
||||||
Those three flags are very self-explanatory. The first one will print the help.
|
`--help` to show help on what commands you can use.
|
||||||
The second — version and license. And the last one will print all
|
|
||||||
supported currencies. They are not combinable.
|
`--version` to show version of program.
|
||||||
|
|
||||||
|
`--list-currencies` to show what currencies supported and which one is default.
|
||||||
|
|
||||||
## How to put coins in
|
## How to put coins in
|
||||||
|
|
||||||
@ -37,28 +48,30 @@ piggybank-put <file> [-r | --reverse] <coins> [(-c | --currency) <currency>]
|
|||||||
Here's how to put coins in a piggybank file. It will also create a file if it
|
Here's how to put coins in a piggybank file. It will also create a file if it
|
||||||
doesn't exist.
|
doesn't exist.
|
||||||
|
|
||||||
<file> is a name of a piggy bank file wich may not have a .pb extension at the
|
`<file>` is a name of a piggy bank file wich may not have a .pb extension at the
|
||||||
end, it will be added automatically.
|
end, it will be added automatically.
|
||||||
|
|
||||||
<coins> is a set of coins' counts separated with space character. For example:
|
`<coins>` is a set of coins' counts separated with space character. For example:
|
||||||
0 0 0 5 0 4 6 7. By default trailing zeroes will be added from the
|
0 0 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
|
left. So if you wrote something like 6 0 5 12 then it will be complemented to
|
||||||
0 0 0 0 6 0 5 12 if currency has 8 coins.
|
0 0 0 0 6 0 5 12 if currency has 8 coins.
|
||||||
|
|
||||||
--reverse flag reverses the order of coins. By default they come from least
|
`--reverse` flag reverses the order of coins. By default they come from least
|
||||||
significant face value to the most significant one and as stated above being
|
significant face value to the most significant one and as stated above being
|
||||||
complemented from left so a set shorter than number of coins in a currency,
|
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 0 0 5 8 4. And this flag will make it
|
e.g. 5 8 4 will be interpreted as 0 0 0 0 0 5 8 4. And this flag will make it
|
||||||
to be interpreted as 5 8 4 0 0 0 0 0. It is convenient if you want to add only
|
to be interpreted as 5 8 4 0 0 0 0 0. It is convenient if you want to add only
|
||||||
coins of low face value (e.g. cents or kopeks).
|
coins of low face value (e.g. cents or kopeks).
|
||||||
|
|
||||||
--currency parameter specifies the currency of a new piggy bank. It will not
|
`--currency` parameter specifies the currency of a new piggy bank. It will not
|
||||||
change currency of an existing piggy bank.
|
change currency of an existing piggy bank.
|
||||||
|
|
||||||
### Examples:
|
### Examples:
|
||||||
|
|
||||||
|
```bash
|
||||||
piggybank-put example.pb 7 4 3 0 5 -c euro
|
piggybank-put example.pb 7 4 3 0 5 -c euro
|
||||||
piggybank-put example -r 0 4 6
|
piggybank-put example -r 0 4 6
|
||||||
|
```
|
||||||
|
|
||||||
## How to take coins out
|
## How to take coins out
|
||||||
|
|
||||||
@ -67,7 +80,7 @@ piggybank-take <file> [-r | --reverse] <coins>
|
|||||||
```
|
```
|
||||||
|
|
||||||
All the parameters are explained above. `--currency` flag is not applicable
|
All the parameters are explained above. `--currency` flag is not applicable
|
||||||
here. It just takes coins out rather putting them in.
|
here.
|
||||||
|
|
||||||
### Examples:
|
### Examples:
|
||||||
|
|
||||||
@ -77,10 +90,12 @@ piggybank-take example.pb -r 0 0 4
|
|||||||
|
|
||||||
## How to see what do you have
|
## How to see what do you have
|
||||||
|
|
||||||
|
```bash
|
||||||
piggybank-show <file> [-t | --transactions]
|
piggybank-show <file> [-t | --transactions]
|
||||||
|
```
|
||||||
|
|
||||||
Without -t flag only summarised information will be printed. --transactions flag
|
Without `-t` flag only summarised information will be printed. `--transactions`
|
||||||
tells the program to print out all the transactions stored in a piggy bank.
|
flag tells the program to print out all the transactions stored in a piggy bank.
|
||||||
|
|
||||||
### Examples:
|
### Examples:
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ http://www.wtfpl.net/ for more details."""
|
|||||||
|
|
||||||
|
|
||||||
PIGGYBANK_FILE_EXTENSION = ".pb"
|
PIGGYBANK_FILE_EXTENSION = ".pb"
|
||||||
|
PIGGYBANK_CONFIGURATION_FILE = "piggybank.conf"
|
||||||
|
|
||||||
|
|
||||||
def print_program_version() -> None:
|
def print_program_version() -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user