aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 159733d9ed5e955dd3e56aa5bd273384d6ab196b (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
63
64
65
66
67
68
69
70
71
72
# 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
  agent     Add, update or remove an agent
  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) ON DELETE CASCADE
    )
```

## Examples
Initialize a debt database:
```
debt init
```

Add a new debtor:
```
debt agent -a 'Jane Doe'
```

Delete a created agent
```
debt agent -d 'Jane Doe'
```

Update a created agent:
```
debt agent 'Jane Doe' -u 'Joe 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'
```
Feel free to download, copy and edit any repo