Created
August 7, 2023 09:27
-
-
Save AntoineSebert/831f90753f5f56b778197c4e9aef05cb to your computer and use it in GitHub Desktop.
Removes artifacts from projects in folders and subfolders recursively
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cargo_clean_all() { | |
# Description: Removes artifacts from projects in folders and subfolders recursively | |
# Usage: cargo_clean_all [<folder>] | |
if [ $# -eq 0 ]; then | |
TARGET_FOLDER="." | |
else | |
TARGET_FOLDER=$1 | |
fi | |
if [ -x "$(command -v fdfind)" ]; then | |
FILEPATHS=$(fdfind Cargo.toml "${TARGET_FOLDER}") | |
elif [ -x "$(command -v fd)" ]; then | |
FILEPATHS=$(fd Cargo.toml "${TARGET_FOLDER}") | |
else | |
FILEPATHS=$(find "${TARGET_FOLDER}" -name Cargo.toml) | |
fi | |
for filepath in $(echo ${FILEPATHS}); do | |
echo "cleaning $filepath..." | |
cargo clean --manifest-path "${filepath}" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment