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

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

readSingleFile = (f) -> parseFile p, (err, res) ->
  addResult res, result
  result.summary = res.stats
  print err, result, options, fmtOpts

readDir = (dir) ->

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

  processFile = (f, next) -> parseFile f, (err, r) ->
    addResult r, result
    next()

  readdirp { root: dir, fileFilter: exts }, (err, res) ->
    async.forEach (filterFiles res.files), processFile, finish

p = programm.args[0]

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

    else
      files

  (r.path for r in res)

options = {}
fmtOpts = []
