 
 return programm.help() if programm.args.length < 1
 
-result = files: []
-
 groupByExt = (data) ->
   map = {}
   for f in data.files

    res.stats = sloc code, options.alias[ext] or ext
    cb null, res

print = (err, result, opts, fmtOpts) ->
  return console.error "Error: #{err}" if err
  f = programm.format or 'simple'
  unless (fmt = fmts[f])?
    return console.error "Error: format #{f} is not supported"
  out = fmt result, opts, fmtOpts
  out = out.replace colorRegex, '' if programm.stripColors
  console.log out if typeof out is "string"

addResult = (res, all) ->
  if res.badFile then all.brokenFiles++
  all.files.push res

filterFiles = (files) ->
  res =

    d.summary = helpers.summarize d.files.map (x) -> x.stats
  map

readSingleFile = (f, done) -> parseFile f, (err, res) ->
  done err, [res]

readDir = (dir, done) ->
  processFile = (f, next) -> parseFile (path.join dir, f), next

  readdirp { root: dir, fileFilter: exts }, (err, res) ->
    return done(err) if err
    async.map (filterFiles res.files), processFile, done

readSource = (p, done) ->
  fs.lstat p, (err, stats) ->
    if err
      console.error "Error: invalid path argument #{p}"
      return done(err)
    if stats.isDirectory() then return readDir p, done
    else if stats.isFile() then return readSingleFile p, done

async.map programm.args, readSource, (err, parsed) ->
  return console.error "Error: #{err}" if err

  result = files: []

  parsed.forEach (files) ->
    files.forEach (f) ->
      if f.badFile then result.brokenFiles++
      result.files.push f

  result.summary = helpers.summarize result.files.map (x) -> x.stats
  result.byExt = groupByExt result
  print result, options, fmtOpts
