関連記事
GitHub - devlights/blog-summary: ブログ「いろいろ備忘録日記」のまとめ
概要
以下、自分用のメモです。すごく久しぶりにcloc使ったら使い方をすっかり忘れていたので、ついでにここにメモメモ。
特定の言語ファイルのみ対象とする
$ cloc --include-lang="C#" .
特定のディレクトリを除外対象とする
$ cloc --include-lang="C#" --exclude-dir=bin,obj .
各ファイルごとの結果も出力する
$ cloc --include-lang="C#" --exclude-dir=bin,obj --by-file .
CSV出力
$ cloc --include-lang="C#" --exclude-dir=bin,obj --by-file --csv --report-file=result.csv .
TSV出力
$ cloc --include-lang="C#" --exclude-dir=bin,obj --by-file --csv --report-file=result.csv --csv-delimiter=$'\t' .
PowerShell上だとタブを指定するのにクセがあり、以下のようにする。
$ cloc --include-lang="C#" --exclude-dir=bin,obj --by-file --csv --report-file=result.csv --csv-delimiter="`t" .
Markdown出力
$ cloc --include-lang="C#" --exclude-dir=bin,obj --by-file --md --report-file=result.md .
余計な出力をオフ
$ cloc --include-lang="C#" --exclude-dir=bin,obj --by-file --csv --report-file=result.csv --csv-delimiter=$'\t' --quiet .
参考情報
github.com
過去の記事については、以下のページからご参照下さい。
サンプルコードは、以下の場所で公開しています。