diff options
Diffstat (limited to 'modules/new')
-rwxr-xr-x | modules/new | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/modules/new b/modules/new new file mode 100755 index 00000000..18f23902 --- /dev/null +++ b/modules/new @@ -0,0 +1,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('modules.$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 '$2.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('modules.$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('modules.$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 |