项目写久了,就像看看自己一个项目的真实代码有多少行,所以找了下面两个方法

命令行查看

用mac终端自带的的find命令,可以查看目录下每个文件的行数,及最后输出总行数

1
2
3
4
5
6
7
8
# input >
find . "(" -name "*.vue" -or -name "*.html" -or -name "*.ts" -or -name "*.js" ")" -print | xargs wc -l

# output >
423 a.js
1842 b.vue
52 c.html
7253 total

VsCode查看

直接在vscode的全局搜索中(快捷键为Command + Shift + c),输入b*[^:b#/]+.*$,并使用Use Regular Expression选项(即最右侧的星号和方块的按钮),进行搜索,即可查看

1
2
3
4
5
6
7
8
9
# input >
b*[^:b#/]+.*$

# output >
7253 results in 77 files

423 a.js
1842 b.vue
52 c.html

VsCode查看代码行数

祝君无Bug~