yaml-tidy

Mon, 16 Jan 2012 21:42:31 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 16 Jan 2012 21:42:31 +0000
changeset 2
0653a782618c
parent 0
0757d85e604b
permissions
-rwxr-xr-x

yaml-merge: Preserve ordering when merging arrays

0
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env lua5.1
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local yaml = require "yaml";
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 for i, fn in ipairs(arg) do
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 local f = assert(io.open(fn, "r"));
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 print(yaml.dump(yaml.load(f:read("*a"))));
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 f:close();
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 end
0757d85e604b Initial commit
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10

mercurial