sane-wipe: implement --verbose
flag
This commit is contained in:
@@ -1,16 +1,47 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash -p dconf -p libsecret -p procps -p systemdMinimal
|
||||
|
||||
set -eu
|
||||
|
||||
usage() {
|
||||
echo "usage: sane-wipe RESOURCE"
|
||||
echo "usage: sane-wipe [--verbose] RESOURCE [RESOURCE ...]"
|
||||
echo "RESOURCE:"
|
||||
echo " browser: kill and remove cache for firefox, chromium, brave, etc"
|
||||
echo " browser: kill and remove cache for firefox, epiphany, chromium, brave, etc"
|
||||
echo " dino: remove auth and data for Dino XMPP messenger"
|
||||
echo " flare: remove auth and data for flare-signal messenger"
|
||||
echo " fractal: remove auth and data for fractal matrix messenger"
|
||||
echo " rofi: remove rofi .desktop entry cache and force it to recompute entries"
|
||||
}
|
||||
|
||||
resources=()
|
||||
VERBOSE=
|
||||
parseArgs() {
|
||||
while [[ $# -ge 1 ]]; do
|
||||
local arg=$1
|
||||
shift
|
||||
case "$arg" in
|
||||
(browser|dino|flare|fractal|rofi)
|
||||
resources+=("$arg")
|
||||
;;
|
||||
(--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
(--verbose)
|
||||
VERBOSE=1
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ${#resources[@]} -eq 0 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
wipe_browser() {
|
||||
# remove chromium/epiphany/firefox/librewolf artifacts
|
||||
@@ -71,29 +102,15 @@ wipe_rofi() {
|
||||
rm -f ~/.cache/rofi/rofi-drun-desktop.cache
|
||||
}
|
||||
|
||||
main() {
|
||||
if [ -n "$VERBOSE" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
(browser)
|
||||
wipe_browser
|
||||
;;
|
||||
(dino)
|
||||
wipe_dino
|
||||
;;
|
||||
(flare)
|
||||
wipe_flare
|
||||
;;
|
||||
(fractal)
|
||||
wipe_fractal
|
||||
;;
|
||||
(rofi)
|
||||
wipe_rofi
|
||||
;;
|
||||
(--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
for r in "${resources[@]}"; do
|
||||
"wipe_$r"
|
||||
done
|
||||
}
|
||||
|
||||
parseArgs "$@"
|
||||
main
|
||||
|
Reference in New Issue
Block a user