lucaterm 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/lib/luca_term/book.rb +20 -4
- 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: fb1f374a09f0de19e379ea58a0d99d4dc7a0e5eb417bb98121c45a9b60b16043
|
4
|
+
data.tar.gz: 7fe2cf713fafcc830e1e43132385988073e9ea60b856916f19980f8e9bc8e7d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db9a08c3a2014a9c35e51ec242ea1b1d1ab74fb211dddf6cf2baedc6a6ef7d1a615db33dc12ae6d1c06f1b275049e3da7f767c34e5f13aa89f2c770e9d76309a
|
7
|
+
data.tar.gz: 24da76ce1f12b9a55d974375274ce7c8a406502bd1e083760b1e22a565eb78bb6ccf0a9559105d84aaae0703a0d6cfc3a228f6bf732f221a16fe55ac9280e56d
|
data/CHANGELOG.md
CHANGED
data/lib/luca_term/book.rb
CHANGED
@@ -57,6 +57,18 @@ module LucaTerm
|
|
57
57
|
@visible = set_visible(@data)
|
58
58
|
when KEY_ENTER, KEY_CTRL_J
|
59
59
|
show_detail(@data[@index])
|
60
|
+
when 'N'
|
61
|
+
newdate = edit_dialog "Enter date of new record: YYYY-m-d"
|
62
|
+
tmpl = {
|
63
|
+
date: newdate,
|
64
|
+
debit: [
|
65
|
+
{ code: '10XX', amount: 0 }
|
66
|
+
],
|
67
|
+
credit: [
|
68
|
+
{ code: '50XX', amount: 0 }
|
69
|
+
],
|
70
|
+
}
|
71
|
+
show_detail(tmpl)
|
60
72
|
when 'q'
|
61
73
|
exit 0
|
62
74
|
end
|
@@ -69,6 +81,7 @@ module LucaTerm
|
|
69
81
|
debit_length = Array(record[:debit]).length
|
70
82
|
credit_length = Array(record[:credit]).length
|
71
83
|
date, txid = LucaSupport::Code.decode_id(record[:id]) if record[:id]
|
84
|
+
date ||= record[:date]
|
72
85
|
loop do
|
73
86
|
window.setpos(0, 0)
|
74
87
|
window << "#{date} "
|
@@ -131,7 +144,7 @@ module LucaTerm
|
|
131
144
|
@d_h = 0
|
132
145
|
end
|
133
146
|
when 'n'
|
134
|
-
position = [0,1].include?(@d_h) ? :debit : :credit
|
147
|
+
position = [0, 1].include?(@d_h) ? :debit : :credit
|
135
148
|
new_code = select_code
|
136
149
|
next if new_code.nil?
|
137
150
|
|
@@ -155,7 +168,11 @@ module LucaTerm
|
|
155
168
|
record[position][@d_v][:amount] = new_amount
|
156
169
|
end
|
157
170
|
when 's', KEY_CTRL_S
|
158
|
-
|
171
|
+
if record[:id]
|
172
|
+
LucaBook::Journal.save record
|
173
|
+
else
|
174
|
+
LucaBook::Journal.create record
|
175
|
+
end
|
159
176
|
break
|
160
177
|
when 'q'
|
161
178
|
break
|
@@ -195,6 +212,7 @@ module LucaTerm
|
|
195
212
|
|
196
213
|
def select_code
|
197
214
|
list = @dict.map{ |code, entry| { code: code, label: entry[:label] } }
|
215
|
+
.select{ |d| d[:code].length >= 3 }
|
198
216
|
visible_dup = @visible
|
199
217
|
index_dup = @index
|
200
218
|
active_dup = @active
|
@@ -208,8 +226,6 @@ module LucaTerm
|
|
208
226
|
line = format("%s %s", entry[:code], entry[:label])
|
209
227
|
if i == @active
|
210
228
|
window.attron(A_REVERSE) { window << line }
|
211
|
-
elsif @visible[i][:code].length <= 2
|
212
|
-
window.attron(A_UNDERLINE) { window << line }
|
213
229
|
else
|
214
230
|
window << line
|
215
231
|
end
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|