Skip to content

Commit f38fdc8

Browse files
committed
wrap
1 parent a405b43 commit f38fdc8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

saltwrap

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env ruby
2+
require "open3"
3+
lines = File.open(ARGV[0]).readlines
4+
newl = []
5+
chunk = ""
6+
lines.each do |line|
7+
if line.strip.start_with?("-")
8+
chunk += line[1, line.length]
9+
else
10+
if chunk != ""
11+
l, s = Open3.capture2("salty -j", :stdin_data => chunk)
12+
newl << l
13+
chunk = ""
14+
end
15+
newl << line
16+
end
17+
end
18+
19+
File.open(ARGV[0], "w") do |file|
20+
newl.each do |line|
21+
file.write line
22+
end
23+
end

0 commit comments

Comments
 (0)