Skip to content

Instantly share code, notes, and snippets.

@raine
Last active May 4, 2020
Embed
What would you like to do?
Browse Ramda documentation in Terminal
#!/usr/bin/env bash
# Browse Ramda documentation in Terminal
# Requires jq and a tool such as fzf or peco for interactive filtering
LATEST="http://raine.github.io/ramda-json-docs/latest.json"
DOCS_URL="http://ramdajs.com/docs/"
json=$(curl -s $LATEST)
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end')
fn=$(echo "$functions" | fzf --reverse) || exit 0
fn_name=$(echo $fn | awk '{print $1}')
desc=$(echo "$json" | jq -r ".[] | select(.name == \"$fn_name\") | .description" | fmt)
docs_url="$DOCS_URL#$fn_name"
echo "$fn"
echo
echo "$desc"
echo
echo "$docs_url"
# Open URL in browser
# open $docs_url # mac
# xdg-open $docs_url # linux
@arcseldon
Copy link

arcseldon commented Jan 28, 2016

Thanks, this is very helpful. tempted to buy the alfred 2 license just for the convenience of ramda... much appreciated.

@rootscript
Copy link

rootscript commented Oct 1, 2016

@raine - Would really love to do the same with Electron api docs:

https://github.com/electron/electron/releases/download/v1.4.1/electron-api.json
http://electron.atom.io/docs/all/

Can you take a look at these 2 links and tell me if it is possible (easy) - THANkS

@bliotti
Copy link

bliotti commented Jun 22, 2018

Can anyone provide more detail on how I run this? I have installed jq and fzf thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment