misc-scripts/ansiblequickdocs.zsh

10 lines
429 B
Bash
Executable File

#!/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 class="std std-ref"\>).*(?=\<\/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"