Created
September 21, 2022 08:05
-
-
Save Dimfred/0b4d7b4c18f6ccc0567a5457e2575ad5 to your computer and use it in GitHub Desktop.
Rofi registryv2 clean / delete
This file contains 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
#!/usr/bin/env zsh | |
REGISTRY="<YOU_REGISTRY_URL_HERE>" | |
sel() { | |
echo "$1" | rofi -dmenu -multi-select -config "~/.config/rofi/config-multi-select.rasi" | |
} | |
PARSE=" | |
import sys | |
import re | |
res = sys.argv[-1] | |
res = res.split('\n') | |
res = res[2:] | |
all_tags = [] | |
for line in res: | |
line = line.replace(',', '') | |
line = line.split(' ') | |
line = [i for i in line if i] | |
repo, *tags = line | |
for tag in tags: | |
tag = f'{repo}:{tag}' | |
all_tags.append(tag) | |
print('\n'.join(all_tags)) | |
" | |
main() { | |
# reg has to be installed | |
res="$(reg ls $REGISTRY)" | |
res="$(python3 -c "$PARSE" "$res")" | |
selection=$(sel "$res") | |
for s in $(echo $selection | xargs); do | |
reg rm "$REGISTRY/$s" | |
done | |
} | |
main $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment