cgag / loc

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

Hi, Can you add a COLUMN for Percentage? #72

Open biluohc opened 6 years ago

biluohc commented 6 years ago

look like the follow probably:

--------------------------------------------------------------------------------
 Language       Percentage      Files        Lines        Blank      Comment         Code
--------------------------------------------------------------------------------
 Rust              85.39%      13         1637          137          103         1397
 Toml              0.20%       4          156           28           17          111
 Markdown           0.20%      1           59           15            0           44
 CSS                0.20%      1           65           15            7           43
--------------------------------------------------------------------------------
 Total             100%      19         1917          195          127         1595
--------------------------------------------------------------------------------
cgag commented 6 years ago

I like this idea. I've been pretty absent but should have some freetime in a few weeks. I want to play with this along side a PR for optionally increasing the output width.

cauebs commented 6 years ago

Perhaps like this?

------------------------------------------------------------------------------
 Language         Files     Blank          Comment           Code       Total 
------------------------------------------------------------------------------
 Lua                2    24193 (00%)    193544 (00%)    169351 (00%)   387088 
 Rust               4      110 (00%)        31 (00%)      1061 (00%)     1202 
 C                  4       75 (00%)       155 (00%)       470 (00%)      700 
 Markdown           2       40 (00%)         0 (00%)       273 (00%)      313 
 Bourne Shell       3       18 (00%)         7 (00%)        59 (00%)       84 
 YAML               1       13 (00%)        19 (00%)        57 (00%)       89 
 Ada                2       12 (00%)         9 (00%)        32 (00%)       53 
 Toml               1        4 (00%)         2 (00%)        17 (00%)       23 
 Gherkin            1        2 (00%)         2 (00%)         8 (00%)       12 
 OCaml              1        4 (00%)         6 (00%)         3 (00%)       13 
 Ruby               1        0 (00%)         2 (00%)         2 (00%)        4 
 Handlebars         1        0 (00%)         2 (00%)         2 (00%)        4 
------------------------------------------------------------------------------
 Total             23    24471 (00%)    193779 (00%)    171335 (00%)   389585 
------------------------------------------------------------------------------

I didn't bother to calculate the percentages, but they would be relative to the value of the "Total" column

biluohc commented 6 years ago

@cauebs , thanks your idea. But I think should keep two decimal places. How do you feel about the follow?

Need or not show percentage for Files?

In addition,out style aligin is boring and diffcult, consider to use prettytable-rs @cgag ?

------------------------------------------------------------------------------------------------------------------------------------
 Language             Files               Lines               Blank               Comment                 Code
------------------------------------------------------------------------------------------------------------------------------------
 Rust                    13         1637(85.39%)          137(8.37%)            103(6.29%)         1397(85.33%)
 Toml                     4           156(8.13%)          28(17.95%)            17(10.90%)          111(71.15%)
 Markdown                 1            59(3.07%)          15(%25.42)                    0            44(74.57%)
 CSS                      1            65(3.39%)          15(20.37%)            7(10.77%)            43(66.15%)
------------------------------------------------------------------------------------------------------------------------------------
 Total                   19                 1917         195(10.17%)           127(6.62%)          1595(83.20%)
------------------------------------------------------------------------------------------------------------------------------------