-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
any intention on making a cli interface for this? #307
Comments
would be very much interested in this as well! |
I made a small script that does a request to explainshell and parses its output. It doesn't parse properly in all places, but it's a good starting point: Uses pup for the html parsing: https://github.com/ericchiang/pup #! /usr/bin/bash
# file stored in /tmp/x
input="$@"
parsed="${input// /+}"
curl -s -X GET "https://explainshell.com/explain?cmd=${parsed}" | pup '.help-box text{}' Saving to
|
Nice! |
Let's get this party started explain_lol() {
local input="$@"
local parsed="${input// /+}"
lynx "https://explainshell.com/explain?cmd=${parsed}" \
-dump \
-width=160 \
-nolist | tail -n +8
} Who's next |
Here's a bash script I use for opening explainshell.com for a query in the system's default browser. Save as #!/bin/bash
set -euo pipefail
args="$@"
query=$(printf %s "$args" | jq -sRr @uri)
url="https://explainshell.com/explain?cmd=$query"
if command -v xdg-open &> /dev/null
then
# linux, probably
xdg-open "$url"
elif command -v cmd.exe &> /dev/null
then
# Windows WSL2
cmd.exe /c start "$url"
else
# assume macOS
open "$url"
fi then you can just wtf 'curl -vSL0 http://example.com' to open that in a browser |
Made a simple wrapper for this :) https://github.com/hinsxd/xshell Usage: $ npm i -g @hinsxd/xshell
$ xshell 'your_command_here' or $ xshell # you will be prompted
? Enter command to explain
your_command_here |
Here's how I've been doing it. #!/usr/bin/env bash
#
# explain a shell command using explainshell.com
#
if ! command -v w3m >/dev/null 2>&1; then echo "Missing dependency: w3m" 1>&2; exit 1; fi
grep -v -e explainshell -e • -e □ -e "source manpages" < <(w3m -dump "http://explainshell.com/explain?cmd=$(tr ' ' '+' <<< "$@")")
# EOF |
explain_lol() {
local input
for input in "$@"; do
local parsed="$(printf "%s" "$input" | jq -srR @uri)"
lynx "https://explainshell.com/explain?cmd=${parsed}" \
-dump \
-width=160 \
-nolist | tail -n +8
done
} works with multiple at a time, and properly escapes the command using |
No description provided.
The text was updated successfully, but these errors were encountered: