hledger-forecast 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +3 -2
- data/lib/hledger_forecast/cli.rb +19 -14
- data/lib/hledger_forecast/summarizer_formatter.rb +20 -5
- data/lib/hledger_forecast/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 410b448de275184312f25f5f5cc008fbaf945c27c40827c9f203fd3c14422729
|
4
|
+
data.tar.gz: d9c9f019852246dee148758231bd8619f10e8246459dd2b719ede97f31ee8e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7700e2fc1778ad1e0548cd53ce3648b38ec2f56ce493204b5bb1efedff0d6621c3563ec09494ed2362f926aa3fe22c10f06394f551b5907cb8c9106c2642e3a1
|
7
|
+
data.tar.gz: fba3f08d0c906fddaab46c31a236602b2843a0c6a5f56723cac9fdc89453e46b6871f129d0e8a684d369883f4dfa8a81cfde64e5997cf8ee4485e90e345ad772
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -92,6 +92,7 @@ The available options are:
|
|
92
92
|
-f, --forecast FILE The path to the FORECAST yaml file to summarize
|
93
93
|
-r, --roll-up PERIOD The period to roll-up your forecasts into. One of:
|
94
94
|
[yearly], [half-yearly], [quarterly], [monthly], [weekly], [daily]
|
95
|
+
-v, --verbose Show additional information in the summary
|
95
96
|
-h, --help Show this help message
|
96
97
|
|
97
98
|
## :gear: Configuration
|
@@ -346,11 +347,11 @@ settings:
|
|
346
347
|
|
347
348
|
**Yaml config file and output**
|
348
349
|
|
349
|
-
<img src="https://
|
350
|
+
<img src="https://github.com/olimorris/hledger-forecast/assets/9512444/c3c3222e-f797-4643-bebd-9c94134bee92" alt="Hledger-Forecast" />
|
350
351
|
|
351
352
|
**Summarize command**
|
352
353
|
|
353
|
-
<img src="https://
|
354
|
+
<img src="https://github.com/olimorris/hledger-forecast/assets/9512444/f5017ea2-9606-46ec-8b38-8840dc175e7b" alt="Summarize command" />
|
354
355
|
|
355
356
|
## :paintbrush: Rationale
|
356
357
|
|
data/lib/hledger_forecast/cli.rb
CHANGED
@@ -124,22 +124,27 @@ module HledgerForecast
|
|
124
124
|
options[:roll_up] = rollup
|
125
125
|
end
|
126
126
|
|
127
|
-
opts.on("
|
128
|
-
"
|
129
|
-
options[:
|
127
|
+
opts.on("-v", "--verbose",
|
128
|
+
"Show additional information in the summary") do |_|
|
129
|
+
options[:verbose] = true
|
130
130
|
end
|
131
131
|
|
132
|
-
opts.on("--
|
133
|
-
|
134
|
-
|
135
|
-
end
|
136
|
-
|
137
|
-
opts.on("
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
132
|
+
# opts.on("--from DATE",
|
133
|
+
# "Include transactions that start FROM a given DATE [yyyy-mm-dd]") do |from|
|
134
|
+
# options[:from] = from
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# opts.on("--to DATE",
|
138
|
+
# "Include transactions that run TO a given DATE [yyyy-mm-dd]") do |to|
|
139
|
+
# options[:to] = to
|
140
|
+
# end
|
141
|
+
|
142
|
+
# opts.on("-s", "--scenario \"NAMES\"",
|
143
|
+
# "Include transactions from given scenarios, e.g.:",
|
144
|
+
# "\"base, rennovation, car purchase\"") do |_scenario|
|
145
|
+
# # Loop through scenarios, seperated by a comma
|
146
|
+
# options[:scenario] = {}
|
147
|
+
# end
|
143
148
|
|
144
149
|
opts.on_tail("-h", "--help", "Show this help message") do
|
145
150
|
puts opts
|
@@ -42,8 +42,15 @@ module HledgerForecast
|
|
42
42
|
total = 0
|
43
43
|
items.each do |item|
|
44
44
|
total += item[:amount]
|
45
|
-
|
46
|
-
|
45
|
+
|
46
|
+
if @settings[:verbose]
|
47
|
+
@table.add_row [{ value: item[:category], alignment: :left },
|
48
|
+
{ value: item[:description], alignment: :left },
|
49
|
+
{ value: format_amount(item[:amount]), alignment: :right }]
|
50
|
+
else
|
51
|
+
@table.add_row [{ value: item[:category], colspan: 2, alignment: :left },
|
52
|
+
{ value: format_amount(item[:amount]), alignment: :right }]
|
53
|
+
end
|
47
54
|
end
|
48
55
|
|
49
56
|
@table.add_row [{ value: "TOTAL".bold, colspan: 2, alignment: :left },
|
@@ -78,9 +85,17 @@ module HledgerForecast
|
|
78
85
|
# Sort the array
|
79
86
|
sorted_sums = sort_roll_up(sum_hash, :sum)
|
80
87
|
|
81
|
-
|
82
|
-
|
83
|
-
|
88
|
+
if @settings[:verbose]
|
89
|
+
sorted_sums.each do |hash|
|
90
|
+
@table.add_row [{ value: hash[:category], colspan: 1, alignment: :left },
|
91
|
+
{ value: hash[:descriptions], colspan: 1, alignment: :left },
|
92
|
+
{ value: format_amount(hash[:sum]), alignment: :right }]
|
93
|
+
end
|
94
|
+
else
|
95
|
+
sorted_sums.each do |hash|
|
96
|
+
@table.add_row [{ value: hash[:category], colspan: 2, alignment: :left },
|
97
|
+
{ value: format_amount(hash[:sum]), alignment: :right }]
|
98
|
+
end
|
84
99
|
end
|
85
100
|
end
|
86
101
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hledger-forecast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oli Morris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|