We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b95d2a0 commit 6cace4bCopy full SHA for 6cace4b
lib/tools/loc.coffee
@@ -0,0 +1,27 @@
1
+# Lines of Code tool
2
+
3
+util = require '../utils'
4
+eyes = require 'eyes'
5
+fs = require 'fs'
6
7
+exports.exec = (options, callback) ->
8
+ line_count = 0
9
+ file_count = 0
10
11
+ # Cheating a bit for the async iteration here
12
+ for glob in options._[1...]
13
+ files = util.paths glob
14
+ file_count += files.length
15
16
17
18
19
+ files.forEach (v,i) ->
20
+ fs.readFile v, (err, data) ->
21
+ file_count = file_count - 1
22
+ if err
23
+ # throw err
24
+ return
25
+ line_count += data.toString().split('\n').length
26
+ if file_count == 0
27
+ callback(null, line_count);
0 commit comments