- 安装
npm install -g cloc # cloc
sudo apt install cloc # Debian, Ubuntu
sudo yum install cloc # Red Hat, Fedora
sudo dnf install cloc # Fedora 22 or later
sudo pacman -S cloc # Arch
sudo emerge -av dev-util/cloc # Gentoo dev-util/cloc - Gentoo Packages
sudo apk add cloc # Alpine Linux
doas pkg_add cloc # OpenBSD
sudo pkg install cloc # FreeBSD
sudo port install cloc # macOS with MacPorts
brew install cloc # macOS with Homebrew
choco install cloc # Windows with Chocolatey
scoop install cloc # Windows with Scoop
- 使用
cloc .
cloc --help
- 样例输出, 以gclx-contract 为例
9 text files.
7 unique files.
4 files ignored.
github.com/AlDanial/cloc v 1.94 T=0.03 s (268.0 files/s, 578033.6 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
JSON 2 0 0 14741
JavaScript 3 22 24 132
Solidity 1 18 1 89
Markdown 1 29 0 44
-------------------------------------------------------------------------------
SUM: 7 69 25 15006
-------------------------------------------------------------------------------
- https://zhuanlan.zhihu.com/p/259663572
- Statistic IDEA 插件
- cloc
- 依赖 git 仓库的 gitstats, 有很详细的各种维度的统计图表📈,很牛逼
- 杠精工具之 find 命令
find . -name "*.java" -or -name "*.xml" -print | xargs wc -l
- 下载工具
- rename to cwim
- move to /usr/bin 失败,root用户也不行,于是移到 ~/目录
- 运行
lmm333@mingmingdeMacBook-Pro 晨间日记_backup % ~/cwim .
样例输出:
cwim - Count Words Inside a Markdown file. (CJK friendly)
Found 222 markdown file(s).
github.com/spencerwooo/cwim v0.1.0 T=0.067s (3315.9 files/s 1796873.8 words/s)
------------------------------------------------------------------+-----------+-------------+--------+--------------
File name | all lines | blank lines | words | reading time
------------------------------------------------------------------+-----------+-------------+--------+--------------
2022-08/22-08-04 周四 第100篇晨间日记.md | 72 | 45 | 727 | 2 mins
话题集锦.md | 122 | 83 | 397 | 1 mins
SUM | 13685 | 8846 | 120301 | 481 mins
------------------------------------------------------------------+-----------+-------------+--------+--------------