readdate.lua

Sun, 21 Jun 2009 18:00:51 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 21 Jun 2009 18:00:51 +0100
changeset 4
305e9dd7fc34
parent 3
487f8d7b81b7
child 10
6700d4722be7
permissions
-rwxr-xr-x

readdate: Make executable

4
305e9dd7fc34 readdate: Make executable
Matthew Wild <mwild1@gmail.com>
parents: 3
diff changeset
1 #!/usr/bin/env lua
305e9dd7fc34 readdate: Make executable
Matthew Wild <mwild1@gmail.com>
parents: 3
diff changeset
2
0
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local ndp = require "ndp";
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 local base;
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 for line in io.lines() do
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 if line:match("^base:%d+$") then
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 base = tonumber(line:match("^base:(%d+)$"));
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 else
3
487f8d7b81b7 Fix for readdate tool
Matthew Wild <mwild1@gmail.com>
parents: 0
diff changeset
10 local ret = ndp.when(line, base);
0
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 print(os.date("%c", ret).." ("..ret..")");
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 end
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 end
44416491923e Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14

mercurial