Add README & deployment examples
This commit is contained in:
70
README.md
Normal file
70
README.md
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# Ledger Quick Note
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Add ledger transactions on the fly!**
|
||||||
|
|
||||||
|
## Feature
|
||||||
|
|
||||||
|
### Transaction Template
|
||||||
|
|
||||||
|
add your transaction template in `tx/` (in Go's template syntax), and create transaction from them on the fly.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
Take some cash
|
||||||
|
```
|
||||||
|
{{ .Date }} * cash
|
||||||
|
expenses:cash ${{ .Amount }}
|
||||||
|
assets:cash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Cash expenses
|
||||||
|
```
|
||||||
|
{{ .Date }} {{ with .Name }}{{ . }}{{ else }}{{ .Account }}{{ end }}
|
||||||
|
{{ .Account }} ${{ .Amount }}
|
||||||
|
expenses:cash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Checkout `tx/` folder for more examples.
|
||||||
|
|
||||||
|
### Ledger Scripts
|
||||||
|
|
||||||
|
Run some commonly used ledger commands.
|
||||||
|
|
||||||
|
Define your commands in config.go
|
||||||
|
|
||||||
|
```go
|
||||||
|
var SCRIPTS = map[string][]string{
|
||||||
|
"balance assets": {"b", "assets", "-X", "$"},
|
||||||
|
"register": {"r", "--tail", "10"},
|
||||||
|
"balance this month": {"b", "-b", "this month"},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Execute them and see the result in the browser.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
* go
|
||||||
|
* ledger (Only required when you use scripts)
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/lancatlin/ledger-quicknote.git
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
go build
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
./ledger-quicknote
|
||||||
|
```
|
||||||
|
|
||||||
|
Checkout `deployment/` for Nginx & Systemd example configuration.
|
||||||
|
|
||||||
12
deployment/nginx.conf
Normal file
12
deployment/nginx.conf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name ledger.example.com;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
auth_basic "private zone";
|
||||||
|
auth_basic_user_file /etc/nginx/myusers;
|
||||||
|
|
||||||
|
proxy_pass http://127.0.0.1:8000;
|
||||||
|
}
|
||||||
|
}
|
||||||
12
deployment/systemd.service
Normal file
12
deployment/systemd.service
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Ledger Quick Note
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=www-data
|
||||||
|
Group=www-data
|
||||||
|
WorkingDirectory=/path/to/ledger-quicknote
|
||||||
|
ExecStart=/path/to/ledger-quicknote/ledger-quicknote -f /path/to/ledger/journal.txt -w /path/to/ledger
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
2
main.go
2
main.go
@@ -131,7 +131,7 @@ func executeScript(w io.Writer, name string) (err error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("%s script not found", name)
|
return fmt.Errorf("%s script not found", name)
|
||||||
}
|
}
|
||||||
cmd := exec.Command("ledger", append([]string{"--init-file", LEDGER_INIT}, script...)...)
|
cmd := exec.Command("ledger", append([]string{"--init-file", LEDGER_INIT, "--file", LEDGER_FILE}, script...)...)
|
||||||
cmd.Dir = WORKING_DIR
|
cmd.Dir = WORKING_DIR
|
||||||
cmd.Stdout = w
|
cmd.Stdout = w
|
||||||
cmd.Stderr = w
|
cmd.Stderr = w
|
||||||
|
|||||||
BIN
screenshots/exec.png
Normal file
BIN
screenshots/exec.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
screenshots/home.png
Normal file
BIN
screenshots/home.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user