#!/bin/zsh CACHE=~/.cache/ansbile-mods ENDPOINT="https://docs.ansible.com/ansible/latest/modules" IFS=$'\n' ([ ! -r $CACHE ] || [ ! -s $CACHE ]) && curl -sL "${ENDPOINT}/list_of_all_modules.html" | grep -oP '(?<=\).*(?=\<\/span\>)' > $CACHE NAMES=($(< $CACHE)) SEL=$((for i in ${NAMES}; do print "$i"; done) | dmenu -i -l 20 -p "Module") [ ! -z $SEL ] && xdg-open "${ENDPOINT}/${SEL%% *}_module.html"