equal
deleted
inserted
replaced
|
1 |
|
2 local spell = { desc = "Spell checker" } |
1 |
3 |
2 local function check (text, lang) |
4 local function check (text, lang) |
3 local fname = os.tmpname() |
5 local fname = os.tmpname() |
4 local fh = io.open(fname, "w") |
6 local fh = io.open(fname, "w") |
5 |
7 |
17 |
19 |
18 os.remove(fname) |
20 os.remove(fname) |
19 return result |
21 return result |
20 end |
22 end |
21 |
23 |
22 local function spell (args) |
24 function spell.cmd (args) |
23 if not args then return nil, "What do you want me to spellcheck?" end |
25 if not args then return nil, "What do you want me to spellcheck?" end |
24 local r |
26 local r |
25 local l, s = string.match(args, "^%s*-d%s?([%w_]+)%s+(.*)%s*$") |
27 local l, s = string.match(args, "^%s*-d%s?([%w_]+)%s+(.*)%s*$") |
26 if l then |
28 if l then |
27 r = check(s, l) |
29 r = check(s, l) |