From abfd83ac996d2db4e7791ba47e60b87461fa8074 Mon Sep 17 00:00:00 2001 From: AhFei Date: Mon, 30 Mar 2026 14:09:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20justfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- justfile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/justfile b/justfile index b51f8a7..99c69de 100644 --- a/justfile +++ b/justfile @@ -16,14 +16,20 @@ machine_ip := `ip -4 addr show scope global | grep -oP '(?<=inet\s)\d+(\.\d+){3} git reset --soft HEAD~1 && echo "✅ 空提交已删除"; \ fi -# 将所有文件 amend -amend argument="": - cd "{{root}}" && git add . && git commit --amend {{argument}} +# 将所有文件 amend,若取消则将暂存区文件移出 +@amend: + cd "{{root}}" && git add . && git commit --amend || (git restore --staged . && false) -# 统计代码量 -cloc: - cd {{invocation_directory()}} && git ls-files | xargs cloc +# 列出所有已合并到当前分支(这里指定了 main 分支)的本地分支,过滤掉当前分支(*)和 main、develop 节点,避免删除它们,一次安全地删除剩余的每个分支 +@ciaclean: + git branch --merged origin/main | grep -vE "^\s*(\*|main|develop)" | xargs -n 1 git branch -d +# 统计代码量(支持文件名包含空格) +cloc range="": + cd {{root}} && python lib/generated/time_taken_sum.py && echo "\n" + cd {{invocation_directory()}} && git ls-files -z \ + {{ if range != "all" { "| grep -z -v '^test/'" } else { "" } }} \ + | xargs -0 cloc # === just 管理命令 ===