aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/new
blob: 4cf334f2e0e9131b2c883a9856f68baa9fa16992 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh

# usage:
# ./new [module_name] [language_name]

mkdir $1

cat > $1/init.lua <<_EOF
-- Copyright 2007 Mitchell mitchell<att>caladbolg.net. See LICENSE.

---
-- The $1 module.
-- It provides utilities for editing $2 code.
module('_m.$1', package.seeall)

if type(_G.snippets) == 'table' then
---
-- Container for $2-specific snippets.
-- @class table
-- @name snippets.$1
  _G.snippets.$1 = {}
end

if type(_G.keys) == 'table' then
---
-- Container for $2-specific key commands.
-- @class table
-- @name keys.$1
  _G.keys.$1 = {}
end

require '$1.commands'
require '$1.snippets'

function set_buffer_properties()

end
_EOF

cat > $1/snippets.lua <<_EOF
-- Copyright 2007 Mitchell mitchell<att>caladbolg.net. See LICENSE.

---
-- Snippets for the $1 module.
module('_m.$1.snippets', package.seeall)

local snippets = _G.snippets

if type(snippets) == 'table' then
  snippets.$1 = {}
end
_EOF

cat > $1/commands.lua <<_EOF
-- Copyright 2007 Mitchell mitchell<att>caladbolg.net. See LICENSE.

---
-- Commands for the $1 module.
module('_m.$1.commands', package.seeall)

-- $2-specific key commands.
local keys = _G.keys
if type(keys) == 'table' then
  keys.$1 = {
    al = { textadept.io.open, _HOME..'/modules/$1/init.lua' },
  }
end
_EOF