30 lines
579 B
Bash
30 lines
579 B
Bash
#!/usr/bin/env bash
|
|
|
|
action=${action:?}
|
|
|
|
# do nothing on some selected actions
|
|
if [ "$action" = "completions" ] || [ "$action" = "flatpak" ] || [ "$action" = "run" ]
|
|
then
|
|
return
|
|
fi
|
|
|
|
clean=${args[--clean]:-}
|
|
target=${args[target]:?}
|
|
|
|
if [ "$action" = "exe" ]
|
|
then
|
|
target="$HOME/.local/bin/$target"
|
|
fi
|
|
|
|
if [ -n "$clean" ] || [ -n "${AUTOINSTALL_CLEAN:-}" ]
|
|
then
|
|
echo "Cleaning $target"
|
|
|
|
# sanity checks
|
|
if [ -z "$target" ] || [ "$target" = "/" ] || [ "$target" = "$HOME" ] || [ "$target" = "$HOME/" ]
|
|
then
|
|
echo "Invalid target: '$target'"
|
|
exit 1
|
|
fi
|
|
rm -rf "$target"
|
|
fi
|