Skip to content

Instantly share code, notes, and snippets.

@himalay
Forked from jacksonp/explain.sh
Last active August 21, 2018 21:37
Show Gist options
  • Select an option

  • Save himalay/4359e43b71f3c0274cb1 to your computer and use it in GitHub Desktop.

Select an option

Save himalay/4359e43b71f3c0274cb1 to your computer and use it in GitHub Desktop.

Revisions

  1. @jacksonp jacksonp revised this gist Mar 26, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion explain.sh
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,9 @@ explain () {
    echo "explain interactive mode."
    echo "explain 'cmd -o | ...' one quoted command to explain it."
    fi
    }
    }

    # Update 26-03-2015. If using this command gives no output, see if running a simple fetch causes this error:
    # $ curl https://www.mankier.com
    # curl: (35) Cannot communicate securely with peer: no common encryption algorithm(s).
    # If so, try specifying a cipher in the curl commands: curl --ciphers ecdhe_ecdsa_aes_128_sha
  2. @jacksonp jacksonp revised this gist Sep 23, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion explain.sh
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,5 @@ explain () {
    echo "Usage"
    echo "explain interactive mode."
    echo "explain 'cmd -o | ...' one quoted command to explain it."
    return
    fi
    }
  3. @jacksonp jacksonp renamed this gist Sep 23, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @jacksonp jacksonp created this gist Sep 23, 2014.
    16 changes: 16 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Add this to ~/.bash_profile or ~/.bashrc
    explain () {
    if [ "$#" -eq 0 ]; then
    while read -p "Command: " cmd; do
    curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd"
    done
    echo "Bye!"
    elif [ "$#" -eq 1 ]; then
    curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1"
    else
    echo "Usage"
    echo "explain interactive mode."
    echo "explain 'cmd -o | ...' one quoted command to explain it."
    return
    fi
    }