爱意满满的作品展示区。
Mark24

代码会说话之一个脚本帮你检查项目 996 状态

  •  
  •   Mark24 ·
    Mark24Code · Aug 16, 2022 · 3469 views
    This topic created in 1560 days ago, the information mentioned may be changed or developed.

    马上要进新组了,一看他们的仓库眼泪留下来

    项目地址 Mark24Code/check_996


    Check 996

    帮助你检查项目 996 状态. 😎

    Usage: check_996.rb [options]
        -s, --start WORK_START_TIME      start job time e.g. 10:00:00
        -e, --end WORK_END_TIME          end job time  e.g. 18:00:00
        -g, --git-log GIT_LOG_CMD        use git log command, default is `git log --all`
        -f, --filter FILTER              time range filter  e.g. last_[day|week|month|year] last_5_[day|week|month|year]   '2022-01-01 08:10:00,2022-10-01 08:10:00'
        -v, --version                    version
    

    使用说明

    依赖项目

    • 确保你有 ruby 2.7+
    • 如果有 curl or wget 可以帮助远程执行

    步骤一:

    终端,进入你想统计的 git 仓库

    cd </path/to/your/git_repo>
    

    步骤二

    终端使用如下命令

    • curl support
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Mark24Code/check_996/main/check_996.rb)"
    
    • wget support
    ruby -e "$(wget https://raw.githubusercontent.com/Mark24Code/check_996/main/check_996.rb -O -)"
    

    更多建议:

    脚本下载在本地可以直接使用参数,远程执行也可以使用参数,使用 -- 分隔参数:

     <script>  -- -s 10:30 -e 19:30
    

    例如自定义理论上的工作时间:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Mark24Code/check_996/main/check_996.rb)" -- -s 10:30 -e 19:30
    

    额外参数说明

    过滤器

    如果我不想对全量 git 进行计算,只关心一段时间,可以使用 -f 参数

    提供人性化语义化参数

    -f, --filter FILTER              time range filter  e.g. last_[day|week|month|year] last_5_[day|week|month|year]   '2022-01-01 08:10:00,2022-10-01 08:10:00'
    

    例如

    -f last_week
    -f last_month
    -f last_25_days
    -f '2022-01-01 08:10:00,2022-10-01 08:10:00'
    

    统计方式

    默认使用 git log --all 会在当前分支进入可触达分支,也可以自己定义, 但是检查必须是 git log xxxx

    -g, --git-log GIT_LOG_CMD        use git log command, default is `git log --all`
    
    10 replies  •  2022-08-19 07:22:06 +08:00
    Mark24
    Mark24
    OP
    Aug 16, 2022
    2
    @releaseme 想到一块去了
    nightsky
    nightsky
    Aug 17, 2022
    3
    可以转载到公众号不啊?大佬,会注明出处
    Mark24
    Mark24
    OP
    Aug 17, 2022
    4
    @nightsky 可以
    FrankAdler
    FrankAdler
    Aug 17, 2022 via iPhone
    5
    好东西
    hululu
    hululu
    Aug 17, 2022
    6
    很 nice
    ZhuWenJian
    ZhuWenJian
    Aug 18, 2022
    7
    创意绝了。入职新公司,第一天就 check 下代码提交时间,看加班多不多,多就赶紧 6
    crayygy
    crayygy
    Aug 18, 2022
    8
    全球化公司咋办... 一天 24 小时几乎都有人在 commit
    Mark24
    Mark24
    OP
    Aug 19, 2022 via Android
    10
    @crayygy 这个确实。不过全球公司一般不担心 996
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4746 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 01:20 · PVG 09:20 · LAX 17:20 · JFK 20:20
    ♥ Do have faith in what you're doing.