Created
October 2, 2019 12:53
-
-
Save curist/565346cd6937ac894391f33e7e6dc3ff to your computer and use it in GitHub Desktop.
This file contains 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
jdoc() { | |
export JANET_PATH=/usr/local/lib/janet | |
janet -l ~/scripts/misc/import-all -e '(import-all) (each b (all-bindings) (print b))' \ | |
| fzf --preview "echo {} | xargs -I[] \ | |
janet -l ~/scripts/misc/import-all \ | |
-e '(import-all) \ | |
(def is-fun (let [t (type [])] (or (= t :function) (= t :cfunction)))) \ | |
(if is-fun (doc []) (do (pp (type []))(pp [])))' \ | |
| sed 's/^\s*//g' \ | |
| awk NF" \ | |
--preview-window top:70%:wrap \ | |
--bind "alt-j:preview-down,alt-k:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up" \ | |
| xargs -I{} janet -l ~/scripts/misc/import-all \ | |
-e "(import-all) \ | |
(def is-fun (let [t (type {})] (or (= t :function) (= t :cfunction)))) \ | |
(if is-fun (doc {}) \ | |
(do \ | |
(print (quote {})) \ | |
(pp (type {})) \ | |
(pp {})))" | |
} | |
# alt+j to bring up jdoc | |
bind -x '"\ej":"jdoc"' |
This file contains 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
(defn import-all [] | |
(def modules | |
(->> (os/dir (dyn :syspath)) | |
(filter |(string/has-suffix? "janet" $)) | |
(map |((string/split "." $) 0)))) | |
(each m modules (import* m))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment