-
-
Save adalessa/b2c722004f9f0fbd9e6cf28a58ea0dc4 to your computer and use it in GitHub Desktop.
Command line scrip for searching laravel documentation
This file contains hidden or 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
#!/bin/bash | |
BASE_URL="https://laravel.com/docs/" | |
VERSION="${LDOC_DEFAULT_VERSION:-5.8}" | |
OPEN_WITH="xdg-open" | |
if [ "$1" != "" ]; then | |
VERSION=$1 | |
fi | |
FULL_URL="$BASE_URL$VERSION/" | |
echo $FULL_URL | xargs curl -s | hxnormalize -x | hxselect "section > ul > li > ul > li > a::attr(href)" | sed 's|href|\nhref|g' | sed -r 's/.*href="([^"]*)".*/\1/' | sed 's|/|\ |g' | awk '{print $3}' | sed '/^$/d' | fzf | sed -e 's|^|'"$FULL_URL"'|' | xargs -r $OPEN_WITH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This requires to have installed HTML-XML-utils, FZF