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 管理命令 ===