# Debt A debt recorder, which helps to remember who owns you money ## Usage ``` Usage: debt [OPTIONS] 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 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' ```