AI代码 场景 重建 phpstorm 打开记录,便于搜索

上AI代码:

#!/bin/bash

# 定义要查找的根目录
ROOT_DIR="/data/code/"

# 定义phpstorm的启动脚本路径
PHPSTORM_PATH="${HOME}/.local/share/JetBrains/Toolbox/apps/phpstorm-2/bin/phpstorm.sh"
BIN_PATH="${HOME}/.local/share/JetBrains/Toolbox/apps/phpstorm-2/jbr/bin/java"

# 临时文件保存包含.idea目录且为phpstorm项目的文件夹路径
IDEA_DIRS_FILE=$(mktemp)

# 查找包含.idea目录的文件夹,并排除版本控制目录
find "$ROOT_DIR" -type d -name ".idea" -not -path "*/\.git/*" -not -path "*/\.vsc/*" | while read -r IDEA_DIR; do
  if [ -f "$IDEA_DIR/php.xml" ]; then
    PROJECT_DIR=$(dirname "$IDEA_DIR")
    echo "$PROJECT_DIR" >> "$IDEA_DIRS_FILE"
  fi
done

# 读取并打开项目
TOTAL_PROJECTS=$(wc -l < "$IDEA_DIRS_FILE")
CURRENT_PROJECT=0

while read -r PROJECT_DIR; do
  ((CURRENT_PROJECT++))
  echo "Opening project $CURRENT_PROJECT of $TOTAL_PROJECTS: $PROJECT_DIR"
  "$PHPSTORM_PATH" "$PROJECT_DIR" &

  # 等待3秒后关闭phpstorm
  sleep 3
  pkill -f "$BIN_PATH"
done < "$IDEA_DIRS_FILE"

# 删除临时文件
rm "$IDEA_DIRS_FILE"

echo "All projects processed."

当前还没有任何评论

写下你最简单的想法