lucaterm 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/luca_term/book.rb +34 -8
- data/lib/luca_term/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: 7df4a6c4af247cc5988cc6cfb28c7f0cf467201d563cfd79f24e50ec1e1564d2
|
4
|
+
data.tar.gz: f6faeb7ae1c43e29bc4f21595438fd2256716548862ffdef28cda330c6d79f2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e1aadcc16ac61664139964c776aae32f2bd5a8e81cbe438ea5db6171af6a55a9a81638b5034ce659f2b5b67a0c549f70cbb86415f250f361b54d1c1f034e8a0
|
7
|
+
data.tar.gz: 21f5e6a8a05c23cfa1e61281fa0dc322c89b096c9f3cba892a05578e65cbf7a15194f1fcd08afd311c31c98268df0cd0e294b98dfefc33beca03ce7a92a35b7c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## LucaTerm 0.3.3
|
2
|
+
|
3
|
+
* `luca book`: Now handle BalanceUnmatch error on save.
|
4
|
+
|
5
|
+
## LucaTerm 0.3.2
|
6
|
+
|
7
|
+
* `luca book`: Add 'h'/'l' move as Prev/Next for monthly journals and code selection.
|
8
|
+
|
1
9
|
## LucaTerm 0.3.1
|
2
10
|
|
3
11
|
* `luca book`: Supports monorepo project including multi-app data.
|
data/lib/luca_term/book.rb
CHANGED
@@ -66,14 +66,14 @@ module LucaTerm
|
|
66
66
|
@index = 0
|
67
67
|
@active = 0
|
68
68
|
@visible = set_visible(@data)
|
69
|
-
when '<'
|
69
|
+
when '<', 'h'
|
70
70
|
target = Date.parse("#{@year}-#{@month}-1").prev_month
|
71
71
|
@data = LucaSupport::Code.readable(LucaBook::List.term(target.year, target.month).data)
|
72
72
|
@year, @month = target.year, target.month
|
73
73
|
@index = 0
|
74
74
|
@active = 0
|
75
75
|
@visible = set_visible(@data)
|
76
|
-
when '>'
|
76
|
+
when '>', 'l'
|
77
77
|
target = Date.parse("#{@year}-#{@month}-1").next_month
|
78
78
|
@data = LucaSupport::Code.readable(LucaBook::List.term(target.year, target.month).data)
|
79
79
|
@year, @month = target.year, target.month
|
@@ -210,10 +210,17 @@ module LucaTerm
|
|
210
210
|
record[position][@d_v][:amount] = new_amount
|
211
211
|
end
|
212
212
|
when 's', KEY_CTRL_S
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
213
|
+
begin
|
214
|
+
if record[:id]
|
215
|
+
LucaBook::Journal.save record
|
216
|
+
else
|
217
|
+
LucaBook::Journal.create record
|
218
|
+
end
|
219
|
+
rescue RuntimeError => e
|
220
|
+
if e.message == 'BalanceUnmatch'
|
221
|
+
alert_dialog("Error\n Debit/Credit balance not meet.")
|
222
|
+
next
|
223
|
+
end
|
217
224
|
end
|
218
225
|
break
|
219
226
|
when 'q', 27
|
@@ -327,9 +334,9 @@ module LucaTerm
|
|
327
334
|
cursor_up list
|
328
335
|
when KEY_PPAGE
|
329
336
|
cursor_pageup list, sub.maxy - 2
|
330
|
-
when KEY_LEFT
|
337
|
+
when KEY_LEFT, 'h'
|
331
338
|
cursor_jump tabstop, list, rev: true
|
332
|
-
when KEY_RIGHT
|
339
|
+
when KEY_RIGHT, 'l'
|
333
340
|
cursor_jump tabstop, list
|
334
341
|
when 'G'
|
335
342
|
cursor_last list, sub.maxy - 2
|
@@ -350,6 +357,25 @@ module LucaTerm
|
|
350
357
|
end
|
351
358
|
end
|
352
359
|
|
360
|
+
def alert_dialog(msg)
|
361
|
+
top = window.maxy >= 25 ? 5 : 2
|
362
|
+
sub = window.subwin(6, 35, (window.maxy-6)/2, (window.maxx - 35)/2)
|
363
|
+
sub.box(?|, ?-)
|
364
|
+
sub.setpos(2, 2)
|
365
|
+
sub << msg
|
366
|
+
sub.clrtoeol
|
367
|
+
sub.refresh
|
368
|
+
|
369
|
+
loop do
|
370
|
+
cmd = window.getch
|
371
|
+
case cmd
|
372
|
+
when ' ', 'q', KEY_CTRL_J
|
373
|
+
sub.close
|
374
|
+
return
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
353
379
|
private
|
354
380
|
|
355
381
|
def account_index(maxx = 50)
|
data/lib/luca_term/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucaterm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|