Files
llm-functions/tools/fs_rm.sh
sigoden 86aa910609 refactor: improve bash code (#125)
* refactor: extract guard_path to utils/guard_path.sh

* add utils/guard_operation.sh
2024-11-16 11:09:40 +08:00

21 lines
529 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# @describe Remove the file or directory at the specified path.
# @option --path! The path of the file or directory to remove
# @env LLM_OUTPUT=/dev/stdout The output path
ROOT_DIR="${LLM_ROOT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
main() {
if [[ -f "$argc_path" ]]; then
"$ROOT_DIR/utils/guard_path.sh" "$argc_path" "Remove '$argc_path'?"
rm -rf "$argc_path"
fi
echo "Path removed: $argc_path" >> "$LLM_OUTPUT"
}
eval "$(argc --argc-eval "$0" "$@")"