blob: 2f3b57f239208be81354a09cc3bbff0291c65d63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# Debt
A debt recorder, which helps to remember who owns you money
## Usage
```
Usage: debt [OPTIONS] <COMMAND>
Commands:
init Initialize Database
register Register a transaction
view View Registered data
add Add a new agent to lend or pay
help Print this message or the help of the given subcommand(s)
Options:
-d, --database-path <DATABASE_PATH> file path where data is stored [default: $XDG_DATA_HOME/debt/debt.db [env: DEBT_DB=]
-h, --help Print help
-V, --version Print version
```
## Database
```sql
CREATE TABLE Agents (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE
)
```
```sql
CREATE TABLE Registers (
id INTEGER PRIMARY KEY,
agent_id INTEGER,
register_date INTEGER NOT NULL,
amount INTEGER NOT NULL,
note TEXT,
FOREIGN KEY(agent_id) REFERENCES Agents(id)
)
```
## Examples
Initialize a debt database:
```
debt init
```
Add a new debtor:
```
debt add 'Jane Doe'
```
Borrow 1000 (dollars, euros or whatever) to Jane Doe:
```
debt register 'Jane Doe' 1000 'Some optional note'
```
Register a payment of 50 (of any exchange) from Jane Doe:
```
debt register -p 'Jane Doe' 50 'Another optional note'
```
|