truestuff/delete-all-catalogs.sh
2023-05-08 23:08:59 -04:00

19 lines
387 B
Bash
Executable file

#! /usr/bin/env bash
set -e
get_catalogs() {
midclt call catalog.query | jq -r '.[] | .label' | grep -v 'OFFICIAL'
}
delete_catalog() {
local CATALOG="${1}"
printf 'Deleting catalog: %s... ' "$CATALOG"
midclt call catalog.delete "$CATALOG"
printf '\n'
}
get_catalogs | while read catalog; do
[[ -n "$catalog" ]] || continue
delete_catalog "$catalog"
done