lhj-tools 0.2.81 → 0.2.82
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/lib/lhj/command/local/local.rb +8 -3
- data/lib/lhj/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: e5cb532b2f91d92e8575f55aa8f46251351fe6cf8497732c9436344d41c3f10b
|
|
4
|
+
data.tar.gz: 9e90fce95487eb3185ffad60b9840cefa94e4defff4dab3355a809ad524acc45
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 60613b6d94a186e14a6c06d62e46277658c90804b37d3d62185bc94edba554463ef426de55e687e74338c9617ebaaf09342a7ed21eecb14053ae4068f1d4539a
|
|
7
|
+
data.tar.gz: 96297521dbf1c255087ae94accee5f04de60ea533c6bb46c7ca537c0cc7ceee4ea0269c9b6f7df983821cf676006b071e49f044993ee48fb04395383b2934ff1
|
|
@@ -45,8 +45,11 @@ module Lhj
|
|
|
45
45
|
en_col = @cli.ask('中英对应照csv<<英文>>所在的列, 默认为2: '.yellow, Integer) do |q|
|
|
46
46
|
q.default = 2
|
|
47
47
|
end
|
|
48
|
+
quote_char = @cli.ask('引号字符, 默认为": '.yellow, String) do |q|
|
|
49
|
+
q.default = '"'
|
|
50
|
+
end
|
|
48
51
|
begin
|
|
49
|
-
read_csv_file(csv_file, key_col, cn_col, en_col)
|
|
52
|
+
read_csv_file(csv_file, quote_char, key_col, cn_col, en_col)
|
|
50
53
|
rescue ArgumentError => e
|
|
51
54
|
puts e.message.red
|
|
52
55
|
end
|
|
@@ -91,15 +94,17 @@ module Lhj
|
|
|
91
94
|
File.exist?(dest_file) ? bak_file(dest_file) : dest_file
|
|
92
95
|
end
|
|
93
96
|
|
|
94
|
-
def read_csv_file(file, key_c, cn_c, en_c)
|
|
97
|
+
def read_csv_file(file, quote_char, key_c, cn_c, en_c)
|
|
95
98
|
begin
|
|
96
99
|
current_row = nil
|
|
97
|
-
CSV.foreach(file, quote_char:
|
|
100
|
+
CSV.foreach(file, quote_char: quote_char) do |row|
|
|
98
101
|
current_row = row
|
|
99
102
|
if row.length > 2
|
|
100
103
|
key = row[key_c]
|
|
101
104
|
cn_str = row[cn_c]
|
|
102
105
|
hk_str = row[cn_c]
|
|
106
|
+
cn_str ||= ''
|
|
107
|
+
hk_str ||= ''
|
|
103
108
|
# cn_str = Lhj::Trans::Helper.instance.trans_zh_cn_str(cn_str) if trans_cn
|
|
104
109
|
hk_str = Lhj::Trans::Helper.instance.trans_zh_hk_str(hk_str) if hk_str&.length&.positive?
|
|
105
110
|
@key_map[key] = { key: key, cn: cn_str, hk: hk_str, en: row[en_c] } unless key =~ /[\u4e00-\u9fa5]/
|
data/lib/lhj/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lhj-tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.82
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- lihaijian
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-01-
|
|
11
|
+
date: 2024-01-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xcodeproj
|