     logger.error 'you must specify a location'
     return
 
-  if argv.template not in templateTypes
-    logger.error "unknown template type #{ argv.template }"
+  if not templates[argv.template]?
+    logger.error "unknown template '#{ argv.template }'"
     return
 
-  from = path.join templatesDir, argv.template
+  from = templates[argv.template]
   to = path.resolve location
 
   logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"

    -f, --force             overwrite existing files
    -T, --template <name>   template to create new site from (defaults to 'blog')

    available templates are: #{ templateTypes.join(', ') }

  example:


npm = require 'npm'
{ncp} = require 'ncp'

{NpmAdapter, getStorageDir} = require './common'
{fileExists, fileExistsSync} = require './../core/utils'
{logger} = require './../core/logger'

templates = {}
loadTemplates = (directory) ->
  return unless fileExistsSync directory
  fs.readdirSync(directory)
    .map((filename) -> path.join(directory, filename))
    .filter((filename) -> fs.statSync(filename).isDirectory())
    .forEach((filename) -> templates[path.basename(filename)] = filename)

loadTemplates path.join __dirname, '../../examples/'
loadTemplates path.join getStorageDir(), 'templates/'

usage = """

