-
-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathclean.sh
More file actions
31 lines (22 loc) · 533 Bytes
/
clean.sh
File metadata and controls
31 lines (22 loc) · 533 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env sh
set -eu
clean_usage() {
cat <<EOF
helm secrets clean <dir with secrets>
Clean all decrypted files if any exist
It removes all decrypted ${DEC_SUFFIX} files in the specified directory
(recursively) if they exist.
EOF
}
clean() {
if is_help "$1"; then
clean_usage
return
fi
basedir="$1"
if [ ! -d "${basedir}" ]; then
printf 'Directory does not exist: %s\n' "${basedir}"
exit 1
fi
find "$basedir" -type f -name "*${DEC_SUFFIX}" -exec rm -v {} \;
}