1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # mankier.zshrc: Setup ManKier online manual page service.
4 [[ -z "$AXZSH_PLUGIN_CHECK" ]] || return 92
6 # curl(1) is required to access the online API
7 (( $+commands[curl] )) || return
10 # Explain a shell command. See:
11 # <https://www.mankier.com/blog/explaining-shell-commands-in-the-shell.html>
13 local api_url="https://www.mankier.com/api/v2"
15 if [[ "$#" -eq 0 ]]; then
16 while read 'cmd?Explain: '; do
17 [[ -n "$cmd" ]] || break
18 curl -Gs "$api_url/explain/?cols=$(tput cols)" --data-urlencode q="$cmd" | less
22 curl -Gs "$api_url/explain/?cols=$(tput cols)" --data-urlencode q="$*" | less