偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

我們?nèi)绾慰焖俳y(tǒng)計代碼行數(shù)?

開發(fā) 前端
今天給大家介紹一個特別好用的工具——tokei?,這是是一個用 Rust 編寫的開源工具,用于統(tǒng)計代碼工程中的代碼行數(shù)、注釋、空行數(shù)和文件數(shù)等信息。

大家好,我是了不起。

今天給大家介紹一個特別好用的工具——tokei ,這是是一個用 Rust 編寫的開源工具,用于統(tǒng)計代碼工程中的代碼行數(shù)、注釋、空行數(shù)和文件數(shù)等信息。

它支持非常多的編程語言,并以漂亮的 CLI 表格或多種格式輸出。

一、Tokei 是什么?

Tokei 是類似 cloc 的代碼統(tǒng)計工具,可以快速統(tǒng)計一個項目中:

  • 總行數(shù)
  • 空行數(shù)
  • 注釋行數(shù)
  • 代碼行數(shù)
  • 每種語言的占比

官網(wǎng) GitHub 地址:https://github.com/XAMPPRocky/tokei

?? 二、安裝方式

? 1. 用 Cargo 安裝(推薦)

cargo install tokei

? 2. Mac(使用 Homebrew)

brew install tokei

? 3. Windows(使用 Scoop)

scoop install tokei

? 4. Linux(用包管理器或 cargo)

例如:

sudo apt install tokei       # Ubuntu/Debian(如果源中有)

三、基本用法

? 1. 統(tǒng)計當(dāng)前目錄

tokei

輸出示例:

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 JSON                    1          191          191            0            0
 TOML                    1           12           11            0            1
-------------------------------------------------------------------------------
 Rust                    4           83           76            0            7
 |- Markdown             1            2            0            2            0
 (Total)                             85           76            2            7
===============================================================================
 Total                   6          286          278            0            8
===============================================================================

2. 統(tǒng)計指定文件/目錄

tokei src/ lib.rs

四、常用參數(shù)詳解

參數(shù)

說明

--files

顯示每個文件的詳細(xì)統(tǒng)計

--exclude

排除指定文件或目錄(支持通配符)

--include

只統(tǒng)計指定路徑

--type

只統(tǒng)計某種語言(如 --type Rust

`--output json

toml

`--sort code

lines

--no-ignore

忽略 .gitignore 文件,強制統(tǒng)計所有目錄

--hidden

包括隱藏文件和目錄(如 .git/

五、進階示例

1. 排除某些目錄(比如 target)

tokei --exclude target,node_modules,tests

2. 輸出為 JSON(用于腳本分析)

tokei --output json > stats.json

3. 只查看 Rust 和 Python 的代碼統(tǒng)計

tokei --type Rust --type Python

4. 顯示每個文件的統(tǒng)計詳情

tokei --files

六、和其他工具對比

工具

特點

cloc

Perl 寫的,廣泛使用,跨平臺

tokei

Rust 寫的,性能更快,格式更豐富

scc

Go 寫的,支持多核并行,速度最快

七、tokei 支持的語言

tokei 支持超過 150 種編程語言,包括但不限于:

  • Rust
  • C/C++
  • Java
  • Python
  • Go
  • JavaScript / TypeScript
  • Markdown / HTML / CSS
  • Bash / Shell / PowerShell
  • YAML / TOML / JSON
責(zé)任編輯:武曉燕 來源: Java技術(shù)指北
相關(guān)推薦

2019-08-01 15:08:37

PythonLine操作系統(tǒng)

2017-11-20 14:46:27

命令代碼

2023-09-26 07:34:24

Docker部署依賴包

2010-03-04 15:24:14

Python程序

2020-07-14 08:17:26

代碼執(zhí)行時間

2018-07-03 14:55:25

2020-02-05 17:43:14

數(shù)據(jù)庫PostgreSQL Oracle

2023-09-04 10:10:47

插件頁面元素

2016-12-16 11:07:53

整潔代碼

2012-08-24 10:02:53

Pinterest架構(gòu)工程師

2022-07-26 07:05:50

PythonAPI語法

2020-11-10 17:32:01

數(shù)字貨幣央行數(shù)字貨幣

2022-06-24 09:58:35

大數(shù)據(jù)JavaPython

2020-12-14 13:24:17

PandasSQL數(shù)據(jù)集

2012-09-25 09:14:28

旁觀者效應(yīng)負(fù)面效應(yīng)代碼

2021-01-13 09:42:10

代碼開發(fā)工具

2014-12-26 10:06:48

Docker容器代碼部署

2023-07-16 22:57:38

代碼場景業(yè)務(wù)

2022-02-25 15:59:20

人工智能

2010-06-02 16:32:28

SVN代碼管理
點贊
收藏

51CTO技術(shù)棧公眾號