Created
July 12, 2019 22:30
-
-
Save taviso/b6a70dc55c14d8fb9259a2a351d0acf8 to your computer and use it in GitHub Desktop.
Read MSDN pages in a terminal.
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
# man equivalent for msdn pages so I can look them up in the console. | |
function msdn() | |
{ | |
local lucky="https://www.google.com/search?btnI" | |
local query="q=site:docs.microsoft.com+inurl:/en-us/windows/desktop/" | |
local title="Microsoft Developer Network" | |
local cache="${HOME}/.msdn/" | |
if ! type lynx > /dev/null; then | |
echo "error: lynx is not installed, please install it." 1>&2 | |
return | |
fi | |
if ! test -f "${cache}/${1,,}.gz"; then | |
mkdir -p "${cache}" | |
if ! lynx -nolist -dump "${lucky}&${query}+${1}" > "${cache}/${1,,}"; then | |
rm -f "${cache}/${1,,}" | |
return | |
fi | |
gzip "${cache}/${1,,}" | |
fi | |
zless -isP "s${title} - ${1}" "+/^${1,,}" "${cache}/${1,,}.gz" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment