#!/bin/sh # usage: # ./new [module_name] [language_name] mkdir $1 cat > $1/init.lua <<_EOF -- Copyright 2007 Mitchell mitchellcaladbolg.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 '$2.snippets' function set_buffer_properties() end _EOF cat > $1/snippets.lua <<_EOF -- Copyright 2007 Mitchell mitchellcaladbolg.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 mitchellcaladbolg.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