diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..b6e9e4e Binary files /dev/null and b/.DS_Store differ diff --git a/README.md b/README.md index 949cd8c..e76bd9d 100644 --- a/README.md +++ b/README.md @@ -11,25 +11,39 @@ Terminal dashboard to manage personal finances. Built with [hledger](https://hle -## Features -- View balance - - assets - - expenses - - revenue - - liabilities -- View reports - - income statement - - balance sheet -- View transactions -- Filter by - - account name - - start/end date -- View by period (monthly, yearly) -- Zoom in/out of accounts (change account depth) - - -## Installation +# Features +All *hledger* reports are viewable using Puffin. Some of them are natively supported, others are displayed in a simple scrollable view. + +## View reports + +Puffin supports the following reports natively: +- assets +- expenses +- revenue +- liabilities +- register +- accounts +- commodities + +The following reports are also easily viewable: +- income statement +- balance sheet + +## Filter reports +The data can be filtered by: +- account name +- start/end date +- displayed periodically - weekly, monthly, quaterly, yearly +- change account depth + + +# Installation + +## Download binaries +If you just want to use it, you can download the binary from [here](https://github.com/siddhantac/puffin/releases). + +## Install from source ### Pre-requisites - [hledger](https://hledger.org/) is required for puffin to work. @@ -44,46 +58,67 @@ Terminal dashboard to manage personal finances. Built with [hledger](https://hle ### Run demo * Clone this repo -* Run `make start` +* Run `make debug` ### Run with your own journal file -* Build using `make build` -* Run using `./puffin`. It automatically uses the `$LEDGER_FILE` environment variable - -**Custom path for the journal file** - -There are 2 ways to use a custom path for the journal file. - -1. Run with env var: `LEDGER_FILE= ./puffin` -2. Run with args: `./puffin -file ` - -**Change hledger executable path** - -Run with `./puffin -exe ` - -**Custom reports** - -You can setup custom reports using a config file. - -``` -puffin -cfg config.json +* Use `make start` + +or + +* Run using `make build && ./puffin` + +It uses your hledger setup as it is. So there is no need to setup journal files if you are already using hledger. + +## Configuration + +Puffin can use a config file written in json. It is not required though. Without a config file Puffin will use sane defaults. + +The default config: + +```json +"reports": [ + { + "name": "register", + "cmd": "hledger register" + }, + { + "name": "expenses", + "cmd": "hledger balance type:x" + }, + { + "name": "assets", + "cmd": "hledger balance type:a" + }, + { + "name": "revenue", + "cmd": "hledger balance type:r" + }, + { + "name": "liabilities", + "cmd": "hledger balance type:l" + }, + { + "name": "income statement", + "cmd": "hledger incomestatement" + }, + { + "name": "balance sheet", + "cmd": "hledger balancesheet" + }, + { + "name": "accounts", + "cmd": "hledger accounts --tree", + "locked": true, + } +] ``` -See [config.debug.json](config.debug.json) for ideas. +See [config.debug.json](config.debug.json) for more ideas. ### Keys -| Key | Feature | -| --- | --- | -| ? | toggle help (to remove) | -| q | quit app | -| r | refresh data | -| f | activate filters | -| esc | de-activate filter | -| j/k/up/down | navigate reports | -| up/down | navigate filters (when active) | -| J/K/PgUp/PgDown | scroll inside a report | -| m/u/y | monthly/quarterly/yearly report | +Show this help with `?` +![keybindings](assets/keybindings.png) diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000..04117d6 Binary files /dev/null and b/assets/.DS_Store differ diff --git a/assets/keybindings.png b/assets/keybindings.png new file mode 100644 index 0000000..c3c3d62 Binary files /dev/null and b/assets/keybindings.png differ diff --git a/config.debug.json b/config.debug.json index 44a97ef..5767c1c 100644 --- a/config.debug.json +++ b/config.debug.json @@ -7,17 +7,20 @@ "cmd": "hledger incomestatement -f data/hledger.journal " }, { - "name": "assets", - "cmd": "hledger balance type:a -f data/hledger.journal" + "name": "balance sheet", + "cmd": "hledger balancesheet -f data/hledger.journal " }, { - "name": "expenses-lock", - "cmd": "hledger balance type:x", - "locked": true + "name": "expenses", + "cmd": "hledger balance type:x -f data/hledger.journal" }, { - "name": "expenses", - "cmd": "hledger balance type:x" + "name": "assets", + "cmd": "hledger balance type:a -f data/hledger.journal" + }, + { + "name": "register", + "cmd": "hledger register -f data/hledger.journal" }, { "name": "revenue", @@ -28,12 +31,9 @@ "cmd": "hledger balance type:l -f data/hledger.journal" }, { - "name": "balance sheet", - "cmd": "hledger balancesheet -f data/hledger.journal " - }, - { - "name": "register", - "cmd": "hledger register -f data/hledger.journal" + "name": "expenses(locked)", + "cmd": "hledger balance type:x -f data/hledger.journal", + "locked": true }, { "name": "accounts", diff --git a/gifs/demo.gif b/gifs/demo.gif index a61d75e..e8aa569 100644 Binary files a/gifs/demo.gif and b/gifs/demo.gif differ diff --git a/gifs/demo.tape b/gifs/demo.tape index 734f0ec..217191c 100644 --- a/gifs/demo.tape +++ b/gifs/demo.tape @@ -1,13 +1,13 @@ Set FontSize 20 Set Width 1600 -Set Height 800 +Set Height 1200 Set Framerate 30 Set Padding 12 Output gifs/demo.gif Hide -Type@10ms "puffin -file data/hledger.journal" +Type@10ms "./puffin -cfg config.debug.json" Enter Sleep 2s @@ -15,12 +15,11 @@ Show Sleep 2s -Set TypingSpeed 500ms +Set TypingSpeed 200ms Type "m" Sleep 2s Type "y" - Sleep 2s Down @@ -30,18 +29,13 @@ Sleep 2s Down Sleep 2s Down -Sleep 2s -Down -Sleep 2s -Down - Sleep 2s Type "f" Type "assets" Enter -Sleep 2s - Down +Backspace 4 Type "2022-05-01" Enter Sleep 2s + diff --git a/ui/config.go b/ui/config.go index bb44a81..6f77016 100644 --- a/ui/config.go +++ b/ui/config.go @@ -91,13 +91,17 @@ var DefaultConfig = Config{ func defaultReports() []Report { return []Report{ { - Name: "assets", - Cmd: "hledger balance type:a", + Name: "register", + Cmd: "hledger register", }, { Name: "expenses", Cmd: "hledger balance type:x", }, + { + Name: "assets", + Cmd: "hledger balance type:a", + }, { Name: "revenue", Cmd: "hledger balance type:r", diff --git a/ui/table_graph.go b/ui/table_graph.go index adcf1a1..3959acf 100644 --- a/ui/table_graph.go +++ b/ui/table_graph.go @@ -149,7 +149,7 @@ func (t *TableGraph) plotGraph(rows []float64, legend string) string { } graph := asciigraph.Plot( rows, - asciigraph.SeriesColors(asciigraph.Red), + asciigraph.SeriesColors(asciigraph.IndianRed), asciigraph.Height(t.viewportSize.Height-3), asciigraph.Width(t.viewportSize.Width), asciigraph.SeriesLegends(legend),