Merge pull request #138 from sigoden/feat

This commit is contained in:
sigoden
2024-12-11 08:17:42 +08:00
committed by GitHub
+7 -2
View File
@@ -11,8 +11,13 @@ set -e
ROOT_DIR="${LLM_ROOT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" ROOT_DIR="${LLM_ROOT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
main() { main() {
"$ROOT_DIR/utils/guard_path.sh" "$argc_path" "Write '$argc_path'?" if [[ -f "$argc_path" ]]; then
mkdir -p "$(dirname "$argc_path")" printf "%s" "$argc_contents" | git diff --no-index "$argc_path" - || true
"$ROOT_DIR/utils/guard_operation.sh" "Apply changes?"
else
"$ROOT_DIR/utils/guard_path.sh" "$argc_path" "Write '$argc_path'?"
mkdir -p "$(dirname "$argc_path")"
fi
printf "%s" "$argc_contents" > "$argc_path" printf "%s" "$argc_contents" > "$argc_path"
echo "The contents written to: $argc_path" >> "$LLM_OUTPUT" echo "The contents written to: $argc_path" >> "$LLM_OUTPUT"
} }