Skip to content

Commit b596499

Browse files
committed
Added help and multi-file-set compare to DIFF.LUA
1 parent 285c0ee commit b596499

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

demo/xtra/DIFF.LUA

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env lua
1+
#!/usr/bin/env lua
22

33
CL = 3
44
local function diff_u(fn1, fn2)
@@ -93,5 +93,14 @@ local function diff_u(fn1, fn2)
9393
if #buf.line > 0 then flush_buf() end
9494
end
9595

96-
if #arg < 2 then return end
97-
diff_u(arg[1], arg[2])
96+
if #arg < 2 or #arg % 2 ~= 0 then
97+
print(arg[-1] .. " " .. arg[0] .. [[ old new ...
98+
99+
Compare differences between old and new files and print them as unified context.
100+
To compare multiple sets of files at a time, write as sequential parameters.
101+
Example: ']] .. arg[0] .. [[ old1 new1 old2 new2 old3 new3' etc...]])
102+
os.exit(1)
103+
end
104+
for i = 1, #arg, 2 do
105+
diff_u(arg[i], arg[i + 1])
106+
end

0 commit comments

Comments
 (0)