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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd6fad88274a18a524e2ce05ca8b6e25fccbe359ba7463c307a6528079861667
4
- data.tar.gz: d045d3218d25d78b6dc69e93140d7eb5ea0b88d72e248028fc6e15fbf9bce077
3
+ metadata.gz: fb1f374a09f0de19e379ea58a0d99d4dc7a0e5eb417bb98121c45a9b60b16043
4
+ data.tar.gz: 7fe2cf713fafcc830e1e43132385988073e9ea60b856916f19980f8e9bc8e7d1
5
5
  SHA512:
6
- metadata.gz: 83ad42fcd1547ad456fb4708818db8b2e5e0dad52ec083a6a575ab83a675c16068a384cd224ba9a36c8d31f33eb81d3bd99f66e10167b8dee4042b219c4a4984
7
- data.tar.gz: 900fcdd82a1afd724e8c7c9a36aa76d767129798719427278dbe5f94c51966d110476cf12828c43038147e7b141fc34267e1558125ad9054c0a6b61e6b6e4d9f
6
+ metadata.gz: db9a08c3a2014a9c35e51ec242ea1b1d1ab74fb211dddf6cf2baedc6a6ef7d1a615db33dc12ae6d1c06f1b275049e3da7f767c34e5f13aa89f2c770e9d76309a
7
+ data.tar.gz: 24da76ce1f12b9a55d974375274ce7c8a406502bd1e083760b1e22a565eb78bb6ccf0a9559105d84aaae0703a0d6cfc3a228f6bf732f221a16fe55ac9280e56d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
- ## LucaTerm master
1
+ ## LucaTerm 0.1.1
2
2
 
3
3
  * `luca book`: handle cursor on journal detail
4
- * `luca book`: edit journal
4
+ * `luca book`: add / edit journal
5
5
  * `luca book`: move to another month
@@ -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
- LucaBook::Journal.save record
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaTerm
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
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.0
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-04 00:00:00.000000000 Z
11
+ date: 2021-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses