Skip to content
moqsien edited this page Jan 21, 2024 · 2 revisions

Count lines of code.

moqsien@moqsiendeiMac ~ % g cl -h
Example: cloc <your_path>

Usage:
   cloc [flags]

Aliases:
  cloc, cl

Flags:
  -f, --by-file                Report results for every encountered source file.
  -b, --debug                  Dump debug log for developer.
  -e, --exclude-ext string     Exclude file name extensions (separated commas).
  -h, --help                   help for cloc
  -L, --include-lang string    Include language name (separated commas).
  -m, --match string           Include file name (regex).
  -d, --match-dir string       Include dir name (regex).
  -M, --not-match string       Exclude file name (regex).
  -D, --not-match-dir string   Exclude dir name (regex).
  -o, --output-type string     Show summary only. (default "default")
  -l, --show-lang              Print about all languages and extensions.
  -s, --skip-duplicated        Skip duplicated files.
  -t, --sort-tag string        Sort based on a certain column["name", "files", "blank", "comment", "code"]. (default "name")

Example: count lines of GVC.

moqsien@moqsiendeiMac gvc % g cl .

  Language                              Code                  Files                 Comments              Blank
 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
  Batch                                 98                    1                     0                     19
  Go                                    11587                 93                    481                   1234
  JSON                                  192                   4                     0                     0
  Markdown                              1731                  25                    2                     360
  Plain Text                            3                     1                     0                     0
  VimL                                  50                    1                     22                    5
  YAML                                  82                    2                     0                     0
  Zsh                                   81                    1                     6                     13
  Sum                                   13824                 128                   511                   1631







Press "" or "k" to move up, "" or "j" to move down, "q" to quit. And "g" to goto first line, "G" to last line.