cc-codeline 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin.js +4 -4
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const fs = require('fs');
|
|
3
|
-
const {
|
|
3
|
+
const { extname, resolve } = require('path');
|
|
4
4
|
|
|
5
5
|
const languages = {
|
|
6
6
|
'.js': {
|
|
@@ -43,7 +43,7 @@ const languages = {
|
|
|
43
43
|
comment: /\/\*[\s\S]+?\*\/|\/\/.*/g
|
|
44
44
|
},
|
|
45
45
|
'.py': {
|
|
46
|
-
comment: /'''[\s\S]+?'''
|
|
46
|
+
comment: /'''[\s\S]+?'''|#.*/g
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
let total = 0;
|
|
@@ -56,7 +56,7 @@ const param = process.argv.slice(2);
|
|
|
56
56
|
const isLog = param.includes('-l');
|
|
57
57
|
|
|
58
58
|
const base = process.cwd();
|
|
59
|
-
const path =
|
|
59
|
+
const path = resolve(base, param[0] || '');
|
|
60
60
|
|
|
61
61
|
(() => {
|
|
62
62
|
if (param.includes('-h')) {
|
|
@@ -107,7 +107,7 @@ function readDirectory(dirPath, callback) {
|
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
for (let name of filenames) {
|
|
110
|
-
const filepath =
|
|
110
|
+
const filepath = resolve(dirPath, name);
|
|
111
111
|
const fileStat = fs.statSync(filepath);
|
|
112
112
|
if (fileStat.isDirectory()) {
|
|
113
113
|
readDirectory(filepath, () => {
|