#!/usr/bin/env python3 import os import json import subprocess import sys def get_all_files(): """获取所有需要推送的文件""" result = subprocess.run( ['find', '.', '-type', 'f', '-name', '*.java'], capture_output=True, text=True ) files = result.stdout.strip().split('\n') # 过滤掉不需要的文件 files = [f for f in files if f and not f.startswith('./.trae')] return files def main(): files = get_all_files() print(f"Found {len(files)} Java files to push") for filepath in files: # 移除开头的 ./ if filepath.startswith('./'): filepath = filepath[2:] print(filepath) if __name__ == '__main__': main()