nacha 0.1.18 → 0.1.19
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 +4 -0
- data/README.md +13 -0
- data/exe/nacha +16 -12
- data/lib/nacha/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f162a763c807b6a18e930ef7f44661d6f8ec82ddac42d3d880eafcfe32b6238b
|
4
|
+
data.tar.gz: be6961b0cd3b3894c2b1c039b18b9ac01daeefca64410851abae1c8a0c3bd5b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16f05006ba599cfd2dda8661fb5bbe6a6c3531bd12c1638eba0a221bc55f739c91f002429f543d0eec1a873c166edd96cd3469818b6d7f45e2751367680c575a
|
7
|
+
data.tar.gz: 03044fe5def2aa9b0103f7b859f58100f74961457df73590d5d303383e7ab060cd98e9330ffb3c1a353e52015430faf244fd71181aaba91225b2ca7abffc460e
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.1.19] - 2025-07-27
|
11
|
+
|
12
|
+
- Accept stdin for command line parsing.
|
13
|
+
|
10
14
|
## [0.1.18] - 2025-07-26
|
11
15
|
|
12
16
|
- first build automatically pushed from Github Actions
|
data/README.md
CHANGED
@@ -64,6 +64,19 @@ API may change at any time. Pull requests welcomed
|
|
64
64
|
|
65
65
|
```
|
66
66
|
nacha parse ach_file.ach > ach_file.html`
|
67
|
+
nacha parse -f html ach_file.ach -o ach_file.html`
|
68
|
+
```
|
69
|
+
|
70
|
+
## Parse an ach file into a JSON file
|
71
|
+
|
72
|
+
```
|
73
|
+
nacha parse -f json ach_file.ach > ach_file.json`
|
74
|
+
```
|
75
|
+
|
76
|
+
## Parse an ach file into Markdown
|
77
|
+
|
78
|
+
```
|
79
|
+
nacha parse -f md ach_file.ach > ach_file.md`
|
67
80
|
```
|
68
81
|
|
69
82
|
## Discussion
|
data/exe/nacha
CHANGED
@@ -19,24 +19,29 @@ module Nacha
|
|
19
19
|
desc "parse FILE", "Parse an ACH file"
|
20
20
|
option :output_file, aliases: "-o"
|
21
21
|
option :format, aliases: "-f", default: "html",
|
22
|
-
|
22
|
+
desc: "Output format (html, json, md, markdown, or ach)",
|
23
|
+
enum: %w[html json md markdown ach]
|
23
24
|
option :md_flavor, default: "common_mark", enum: %w[common_mark github]
|
24
|
-
def parse(file_path)
|
25
|
-
|
25
|
+
def parse(file_path = nil)
|
26
|
+
if file_path.nil? || file_path.empty?
|
27
|
+
input_file = $stdin
|
28
|
+
elsif File.exist?(file_path)
|
29
|
+
input_file = File.open(file_path)
|
30
|
+
else
|
26
31
|
puts "Error: File not found at #{file_path}"
|
27
32
|
exit 1
|
28
33
|
end
|
29
34
|
|
30
|
-
|
31
|
-
ach_file = Nacha.parse(
|
35
|
+
raw_records = input_file.read
|
36
|
+
ach_file = Nacha.parse(raw_records)
|
32
37
|
|
33
38
|
if ach_file && ach_file.is_a?(Array) && !ach_file.empty?
|
34
39
|
if options[:output_file]
|
35
40
|
File.open(options[:output_file], "w") do |f|
|
36
|
-
write_output(ach_file, f,
|
41
|
+
write_output(ach_file, f, input_file)
|
37
42
|
end
|
38
43
|
else
|
39
|
-
write_output(ach_file, $stdout,
|
44
|
+
write_output(ach_file, $stdout, input_file)
|
40
45
|
end
|
41
46
|
else
|
42
47
|
puts "Could not parse the file or the file was empty."
|
@@ -52,11 +57,10 @@ module Nacha
|
|
52
57
|
def write_output(ach_records, io, file)
|
53
58
|
formatter_options = {
|
54
59
|
file_name: File.basename(file.path),
|
55
|
-
file_size: file.size,
|
60
|
+
file_size: file.respond_to?(:size) ? file.size : nil,
|
56
61
|
number_of_lines: ach_records.size,
|
57
|
-
created_at: file.ctime,
|
58
|
-
modified_at: file.mtime,
|
59
|
-
checksum: OpenSSL::Digest::SHA256.file(File.expand_path(file.path)).hexdigest,
|
62
|
+
created_at: file.respond_to?(:ctime) ? file.ctime : Time.now,
|
63
|
+
modified_at: file.respond_to?(:mtime) ? file.mtime : Time.now,
|
60
64
|
preamble: HTML_PREAMBLE_FILE,
|
61
65
|
postamble: HTML_POSTAMBLE_FILE
|
62
66
|
}
|
@@ -64,7 +68,7 @@ module Nacha
|
|
64
68
|
case options[:format]
|
65
69
|
when 'ach'
|
66
70
|
output_ach(ach_records, io)
|
67
|
-
when 'md'
|
71
|
+
when 'md', 'markdown'
|
68
72
|
formatter_options[:flavor] = options[:md_flavor].to_sym
|
69
73
|
formatter = Nacha::Formatter::FormatterFactory.get(:markdown, ach_records, formatter_options)
|
70
74
|
io.puts formatter.format
|
data/lib/nacha/version.rb
CHANGED