美文网首页
cloc实用代码统计工具

cloc实用代码统计工具

作者: 1037号森林里一段干木头 | 来源:发表于2020-12-24 10:05 被阅读0次

    简介:cloc是一个非常小型高效开源免费的代码统计工具,支持linux、windows、mac系统。能统计的语言非常非常非常之多,你认识的不认识的都有。

    windows系统下使用

    1. 上GitHub下载cloc.exe


      image.png

    2.使用方法

    • 在cmd命令行中转到cloc.exe所在路径
      2.1 统计某个文件夹下的所有代码文件
      例如:统计D:\mydoc\VS-proj\calculateDistance2\calculateDistance文件夹下的所有文件信息。

    输入:./cloc.exe D:\mydoc\VS-proj\calculateDistance2\calculateDistance


    文件夹目录结构如下 image.png
    统计结果如下: image.png

    2.2 统计单个文件
    例如:统计d:/mydoc/img_grow.py

    输入:./cloc.exe d:/mydoc/img_grow.py

    PS D:\代码统计工具> ./cloc.exe D:\mydoc\imgprocess\img_graw10.py
           1 text file.
           1 unique file.
           0 files ignored.
    
    github.com/AlDanial/cloc v 1.88  T=0.02 s (63.1 files/s, 16222.7 lines/s)
    -------------------------------------------------------------------------------
    Language                     files          blank        comment           code
    -------------------------------------------------------------------------------
    Python                           1             49             30            178
    -------------------------------------------------------------------------------
    
    1. 查看帮助

    ./cloc.exe --help

    4.查看cloc能识别的语言

    ./cloc.exe --show-lang

    输出看一下你就知道这个强不强了

    PS D:\代码统计工具> ./cloc.exe --show-lang
    ABAP                       (abap)
    ActionScript               (as)
    Ada                        (ada, adb, ads, pad)
    ADSO/IDSM                  (adso)
    Agda                       (agda, lagda)
    AMPLE                      (ample, dofile, startup)
    Ant                        (build.xml, build.xml)
    ANTLR Grammar              (g, g4)
    Apex Class                 (cls)
    Apex Trigger               (trigger)
    APL                        (apl, apla, aplc, aplf, apli, apln, aplo, dyalog, dyapp, mipage)
    Arduino Sketch             (ino, pde)
    AsciiDoc                   (adoc, asciidoc)
    ASP                        (asa, ashx, asp, axd)
    ASP.NET                    (asax, ascx, asmx, aspx, master, sitemap, webinfo)
    AspectJ                    (aj)
    Assembly                   (a51, asm, nasm, S, s)
    AutoHotkey                 (ahk, ahkl)
    awk                        (auk, awk, gawk, mawk, nawk)
    Bazel                      (bazel, BUILD)
    Blade                      (blade, blade.php)
    Bourne Again Shell         (bash)
    Bourne Shell               (sh)
    BrightScript               (brs)
    builder                    (xml.builder)
    C                          (c, cats, ec, idc, pgc)
    C Shell                    (csh, tcsh)
    C#                         (cs)
    C++                        (C, c++, cc, CPP, cpp, cxx, h++, inl, ipp, pcc, tcc, tpp)
    C/C++ Header               (H, h, hh, hpp, hxx)
    CCS                        (ccs)
    Chapel                     (chpl)
    Clean                      (dcl, icl)
    Clojure                    (boot, cl2, clj, cljs.hl, cljscm, cljx, hic, riemann.config)
    ClojureC                   (cljc)
    ClojureScript              (cljs)
    CMake                      (cmake, cmake.in, CMakeLists.txt)
    COBOL                      (CBL, cbl, ccp, COB, cob, cobol, cpy)
    CoffeeScript               (_coffee, cakefile, cjsx, coffee, iced)
    ColdFusion                 (cfm, cfml)
    ColdFusion CFScript        (cfc)
    Coq                        (v)
    Crystal                    (cr)
    CSON                       (cson)
    CSS                        (css)
    Cucumber                   (feature)
    CUDA                       (cu, cuh)
    Cython                     (pxd, pxi, pyx)
    D                          (d)
    DAL                        (da)
    Dart                       (dart)
    dhall                      (dhall)
    DIET                       (dt)
    diff                       (diff, patch)
    DITA                       (dita)
    DOORS Extension Language   (dxl)
    DOS Batch                  (BAT, bat, BTM, btm, CMD, cmd)
    Drools                     (drl)
    DTD                        (dtd)
    dtrace                     (d)
    ECPP                       (ecpp)
    EEx                        (eex)
    EJS                        (ejs)
    Elixir                     (ex, exs)
    Elm                        (elm)
    Embedded Crystal           (ecr)
    ERB                        (ERB, erb)
    Erlang                     (app.src, emakefile, erl, hrl, rebar.config, rebar.config.lock, rebar.lock, xrl, yrl)
    Expect                     (exp)
    F#                         (fsi, fs, fs)
    F# Script                  (fsx)
    Fennel                     (fnl)
    Fish Shell                 (fish)
    Focus                      (focexec)
    Forth                      (4th, e4, f83, fb, forth, fpm, fr, frt, ft, fth, rx, fs, f, for)
    Fortran 77                 (F, F77, f77, FOR, FTN, ftn, pfo, f, for)
    Fortran 90                 (F90, f90)
    Fortran 95                 (F95, f95)
    Freemarker Template        (ftl)
    FXML                       (fxml)
    GDScript                   (gd)
    Gencat NLS                 (msg)
    Glade                      (glade, ui)
    GLSL                       (comp, fp, frag, frg, fsh, fshader, geo, geom, glsl, glslv, gshader, tesc, tese, vert, vrx, vsh, vshader)
    Go                         (go)
    Gradle                     (gradle, gradle.kts)
    Grails                     (gsp)
    GraphQL                    (gql, graphql, graphqls)
    Groovy                     (gant, groovy, grt, gtpl, gvy, jenkinsfile)
    Haml                       (haml, haml.deface)
    Handlebars                 (handlebars, hbs)
    Harbour                    (hb)
    Haskell                    (hs, hsc, lhs)
    Haxe                       (hx, hxsl)
    HCL                        (hcl, nomad, tf, tfvars)
    HLSL                       (cg, cginc, fxh, hlsl, hlsli, shader)
    Hoon                       (hoon)
    HTML                       (htm, html, html.hl, xht)
    IDL                        (dlm, idl, pro)
    Idris                      (idr)
    Igor Pro                   (ipf)
    Imba                       (imba)
    INI                        (buildozer.spec, ini, lektorproject, prefs)
    InstallShield              (ism)
    IPL                        (ipl)
    Java                       (java)
    JavaScript                 (_js, bones, es6, jake, jakefile, js, jsb, jscad, jsfl, jsm, jss, mjs, njs, pac, sjs, ssjs, xsjs, xsjslib)
    JavaServer Faces           (jsf)
    JCL                        (jcl)
    Jinja Template             (jinja, jinja2)
    JSON                       (arcconfig, avsc, composer.lock, geojson, gltf, har, htmlhintrc, json, json-tmlanguage, jsonl, mcmeta, mcmod.info, tern-config, tern-project, tfstate, tfstate.backup, topojson, watchmanconfig, webapp, webmanifest, yyp)
    JSON5                      (json5)
    JSP                        (jsp, jspf)
    JSX                        (jsx)
    Julia                      (jl)
    Jupyter Notebook           (ipynb)
    Kermit                     (ksc)
    Korn Shell                 (ksh)
    Kotlin                     (kt, ktm, kts)
    Lean                       (hlean, lean)
    LESS                       (less)
    lex                        (l, lex)
    LFE                        (lfe)
    liquid                     (liquid)
    Lisp                       (asd, el, lisp, lsp, cl, jl)
    Literate Idris             (lidr)
    LiveLink OScript           (oscript)
    LLVM IR                    (ll)
    Logos                      (x, xm)
    Logtalk                    (lgt, logtalk)
    Lua                        (lua, nse, p8, pd_lua, rbxs, wlua)
    m4                         (ac, m4)
    make                       (am, Gnumakefile, gnumakefile, Makefile, makefile, mk)
    Mako                       (mako, mao)
    Markdown                   (contents.lr, markdown, md, mdown, mdwn, mdx, mkd, mkdn, mkdown, ronn, workbook)
    Mathematica                (cdf, ma, mathematica, mt, nbp, wl, wlt, m)
    MATLAB                     (m)
    Maven                      (pom, pom.xml)
    Meson                      (meson.build)
    Modula3                    (i3, ig, m3, mg)
    Mojo                       (mojom)
    MSBuild script             (csproj, vbproj, vcproj, wdproj, wixproj)
    MUMPS                      (mps, m)
    Mustache                   (mustache)
    MXML                       (mxml)
    NAnt script                (build)
    NASTRAN DMAP               (dmap)
    Nemerle                    (n)
    Nim                        (nim, nim.cfg, nimble, nimrod, nims)
    Nix                        (nix)
    Objective-C                (m)
    Objective-C++              (mm)
    OCaml                      (eliom, eliomi, ml, ml4, mli, mll, mly)
    Odin                       (odin)
    OpenCL                     (cl)
    Oracle Forms               (fmt)
    Oracle PL/SQL              (bod, fnc, prc, spc, trg)
    Oracle Reports             (rex)
    Pascal                     (dfm, dpr, lpr, p, pas, pascal)
    Pascal/Puppet              (pp)
    Patran Command Language    (pcl, ses)
    Perl                       (ack, al, cpanfile, makefile.pl, perl, ph, plh, plx, pm, psgi, rexfile, pl, p6)
    PHP                        (aw, ctp, phakefile, php, php3, php4, php5, php_cs, php_cs.dist, phps, phpt, phtml)
    PHP/Pascal                 (inc)
    Pig Latin                  (pig)
    PL/I                       (pl1)
    PL/M                       (lit, plm)
    PO File                    (po)
    PowerBuilder               (pbt, sra, srf, srm, srs, sru, srw)
    PowerShell                 (ps1, psd1, psm1)
    ProGuard                   (pro)
    Prolog                     (P, prolog, yap, pl, p6, pro)
    Protocol Buffers           (proto)
    Pug                        (jade, pug)
    PureScript                 (purs)
    Python                     (buck, build.bazel, gclient, gyp, gypi, lmi, py, py3, pyde, pyi, pyp, pyt, pyw, sconscript, sconstruct, snakefile, tac, workspace, wscript, wsgi, xpy)
    QML                        (qbs, qml)
    Qt                         (ui)
    Qt Linguist                (ts)
    Qt Project                 (pro)
    R                          (expr-dist, R, r, rd, rprofile, rsx)
    Racket                     (rkt, rktd, rktl, scrbl)
    Raku                       (pm6, raku, rakumod)
    Raku/Prolog                (P6, p6)
    RAML                       (raml)
    RapydScript                (pyj)
    Razor                      (cshtml, razor)
    ReasonML                   (re, rei)
    reStructuredText           (rest, rest.txt, rst, rst.txt)
    Rexx                       (pprx, rexx)
    Rmd                        (Rmd)
    RobotFramework             (robot)
    Ruby                       (appraisals, berksfile, brewfile, builder, buildfile, capfile, dangerfile, deliverfile, eye, fastfile, gemfile, gemfile.lock, gemspec, god, guardfile, irbrc, jarfile, jbuilder, mavenfile, mspec, podfile, podspec, pryrc, puppetfile, rabl, rake, rb, rbuild, rbw, rbx, ru, snapfile, thor, thorfile, vagrantfile, watchr)
    Ruby HTML                  (rhtml)
    Rust                       (rs, rs.in)
    SaltStack                  (sls)
    SAS                        (sas)
    Sass                       (sass, scss)
    Scala                      (kojo, sbt, scala)
    Scheme                     (sc, sch, scm, sld, sps, ss, sls)
    sed                        (sed)
    SKILL                      (il)
    SKILL++                    (ils)
    Slice                      (ice)
    Slim                       (slim)
    Smalltalk                  (st, cs)
    Smarty                     (smarty, tpl)
    Softbridge Basic           (SBL, sbl)
    Solidity                   (sol)
    SparForte                  (sp)
    Specman e                  (e)
    SQL                        (cql, mysql, psql, SQL, sql, tab, udf, viw)
    SQL Data                   (data.sql)
    SQL Stored Procedure       (spc.sql, spoc.sql, sproc.sql, udf.sql)
    Squirrel                   (nut)
    Standard ML                (fun, sig, sml)
    Starlark                   (bzl)
    Stata                      (ado, DO, do, doh, ihlp, mata, matah, sthlp)
    Stylus                     (styl)
    SugarSS                    (sss)
    Svelte                     (svelte)
    SVG                        (SVG, svg)
    Swift                      (swift)
    SWIG                       (i)
    Tcl/Tk                     (itk, tcl, tk)
    Teamcenter met             (met)
    Teamcenter mth             (mth)
    TeX                        (aux, bbx, bib, bst, cbx, dtx, ins, lbx, ltx, mkii, mkiv, mkvi, sty, tex, cls)
    Thrift                     (thrift)
    TITAN Project File Information (tpd)
    Titanium Style Sheet       (tss)
    TNSDL                      (cii, cin, in1, in2, in3, in4, inf, interface, rou, sdl, sdt, spd, ssc, sst)
    TOML                       (toml)
    TTCN                       (ttcn, ttcn2, ttcn3, ttcnpp)
    Twig                       (twig)
    TypeScript                 (tsx, ts)
    Unity-Prefab               (mat, prefab)
    Vala                       (vala)
    Vala Header                (vapi)
    Velocity Template Language (vm)
    Verilog-SystemVerilog      (sv, svh, v)
    VHDL                       (VHD, vhd, VHDL, vhdl, vhf, vhi, vho, vhs, vht, vhw)
    vim script                 (vim)
    Visual Basic               (BAS, bas, ctl, dsr, frm, FRX, frx, VB, vb, VBA, vba, VBHTML, vbhtml, VBS, vbs, cls)
    Visual Fox Pro             (SCA, sca)
    Visualforce Component      (component)
    Visualforce Page           (page)
    Vuejs Component            (vue)
    WebAssembly                (wast, wat)
    Windows Message File       (mc)
    Windows Module Definition  (def)
    Windows Resource File      (rc, rc2)
    WiX include                (wxi)
    WiX source                 (wxs)
    WiX string localization    (wxl)
    WXML                       (wxml)
    WXSS                       (wxss)
    XAML                       (xaml)
    xBase                      (prg, prw)
    xBase Header               (ch)
    XHTML                      (xhtml)
    XMI                        (XMI, xmi)
    XML                        (adml, admx, ant, app.config, axml, builds, ccproj, ccxml, classpath, clixml, cproject, cscfg, csdef, csl, ct, depproj, ditamap, ditaval, dll.config, dotsettings, filters, fsproj, gmx, grxml, iml, ivy, jelly, jsproj, kml, launch, mdpolicy, mjml, natvis, ndproj, nproj, nuget.config, nuspec, odd, osm, packages.config, pkgproj, plist, proj, project, props, ps1xml, psc1, pt, rdf, resx, rss, scxml, settings.stylecop, sfproj, shproj, srdf, storyboard, sttheme, sublime-snippet, targets, tmcommand, tml, tmlanguage, tmpreferences, tmsnippet, tmtheme, urdf, ux, vcxproj, vsixmanifest, vssettings, vstemplate, vxml, web.config, web.debug.config, web.release.config, wsf, x3d, xacro, xib, xlf, xliff, XML, xml, xml.dist, xproj, xspec, xul, zcml)
    XQuery                     (xq, xql, xqm, xquery, xqy)
    XSD                        (XSD, xsd)
    XSLT                       (XSL, xsl, XSLT, xslt)
    Xtend                      (xtend)
    yacc                       (y, yacc)
    YAML                       (clang-format, clang-tidy, gemrc, glide.lock, mir, reek, rviz, sublime-syntax, syntax, yaml, yaml-tmlanguage, yml, yml.mysql)
    zsh                        (zsh)
    

    相关文章

      网友评论

          本文标题:cloc实用代码统计工具

          本文链接:https://www.haomeiwen.com/subject/bbgpnktx.html