tree & cloc:建立目錄層級樹、統計程式碼行數

jtsai1120

tree

  • 安裝:$ brew install tree
  • 使用:$ tree . > file_tree.txt
  • 預覽:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    .
    ├── E24126270.docx
    ├── Homework
    │   ├── Makefile
    │   ├── ProbA
    │   │   ├── DC.sdc
    │   │   ├── det_seq.v
    │   │   ├── superlint.tcl
    │   │   └── tb_det_seq.v
    │   ├── ProbB
    │   │   ├── DC.sdc
    │   │   ├── factorial.v
    │   │   ├── superlint.tcl
    │   │   └── tb_factorial.v
    │   └── ProbC
    │   ├── DC.sdc
    │   ├── WashingMachine.v
    │   ├── superlint.tcl
    │   └── tb_WashingMachine.v
    ├── Labinclass
    │   ├── DC.sdc
    │   ├── moore.v
    │   ├── superlint.tcl
    │   └── tb_moore.v
    └── tree.txt

    6 directories, 19 files

cloc

  • 安裝:$ brew install cloc
  • 使用:$ cloc . / $ cloc {file1} {file2} {file3} ...
  • 預覽:
    • $ cloc .
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
          23 text files.
      15 unique files.
      15 files ignored.

      github.com/AlDanial/cloc v 2.04 T=0.01 s (1143.6 files/s, 103988.5 lines/s)
      -----------------------------------------------------------------------------------
      Language files blank comment code
      -----------------------------------------------------------------------------------
      Verilog-SystemVerilog 8 93 40 1022
      make 1 3 6 62
      Tcl/Tk 4 28 32 48
      Text 1 1 0 26
      JSON 1 0 0 3
      -----------------------------------------------------------------------------------
      SUM: 15 125 78 1161
      -----------------------------------------------------------------------------------
    • $ cloc cubic.v ALU.v
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
          2 text files.
      2 unique files.
      0 files ignored.

      github.com/AlDanial/cloc v 2.04 T=0.01 s (337.9 files/s, 26693.8 lines/s)
      -----------------------------------------------------------------------------------
      Language files blank comment code
      -----------------------------------------------------------------------------------
      Verilog-SystemVerilog 2 24 5 129
      -----------------------------------------------------------------------------------
      SUM: 2 24 5 129
      -----------------------------------------------------------------------------------
On this page
tree & cloc:建立目錄層級樹、統計程式碼行數