cgag / loc

Count lines of code quickly.
MIT License
2.29k stars 126 forks source link

`--exclude` does not work properly in Windows CMD #94

Open lingsamuel opened 6 years ago

lingsamuel commented 6 years ago

CMD

image

Powershell

image

Windows version: 10.0.16299.461

cgag commented 5 years ago

Interesting, I'll try to reproduce this now that I have a windows install.

xobs commented 3 months ago

This may have something to do with improper handling of paths. For example, here's what happens when I run loc on Windows:

[5:13:57 pm] E:/Code/Xous/Core> loc --exclude .\loader\src\fonts\hanzi.rs
Error processing exclude regex: regex parse error:
    (.\loader\src\fonts\hanzi.rs)
      ^^
error: unrecognized escape sequence
[5:14:03 pm] E:/Code/Xous/Core>

However, even if I give forward slashes, I get different results when running from WSL2 within the same directory:

[5:17:57 pm] E:/Code/Xous/Core> loc --exclude loader/src/fonts/hanzi.rs --exclude services/graphics-server/src/blitstr2
--------------------------------------------------------------------------------
 Language             Files        Lines        Blank      Comment         Code
--------------------------------------------------------------------------------
 Rust                   920       581985        32143        44220       505622
 JSON                    28       255706            1            0       255705
 C#                      36        13864         1018          815        12031
 Python                  38        14016         1563         3182         9271
 Markdown                87         7776         1566            0         6210
 Toml                   102         3714          422          334         2958
 C                        5         4120          496          682         2942
 Plain Text              11         1306            2            0         1304
 Assembly                 4         1068          147          169          752
 Bourne Shell            13          497           97           47          353
 Ruby                     1          364           10           21          333
 PowerShell               7          307           67           25          215
 Go                       1          153           11           15          127
 C/C++ Header             2           96           20            1           75
 Protobuf                 1           35            1            0           34
 HTML                     1           10            0            0           10
 Makefile                 1            8            3            0            5
--------------------------------------------------------------------------------
 Total                 1258       885025        37567        49511       797947
--------------------------------------------------------------------------------
[5:18:01 pm] E:/Code/Xous/Core> bash -c '~/.cargo/bin/loc --exclude loader/src/fonts/hanzi.rs --exclude services/graphics-server/src/blitstr2'
--------------------------------------------------------------------------------
 Language             Files        Lines        Blank      Comment         Code
--------------------------------------------------------------------------------
 Rust                   905       459837        32031        35122       392684
 JSON                    26       255347            1            0       255346
 C#                      36        13864         1018          815        12031
 Python                  38        14016         1563         3182         9271
 Markdown                84         7375         1473            0         5902
 Toml                   102         3714          422          334         2958
 C                        5         4120          496          682         2942
 Plain Text               2          796            2            0          794
 Assembly                 4         1068          147          169          752
 Bourne Shell            13          497           97           47          353
 PowerShell               7          307           67           25          215
 C/C++ Header             2           96           20            1           75
 Protobuf                 1           35            1            0           34
 HTML                     1           10            0            0           10
 Makefile                 1            8            3            0            5
--------------------------------------------------------------------------------
 Total                 1227       761090        37341        40377       683372
--------------------------------------------------------------------------------
[5:18:03 pm] E:/Code/Xous/Core>