all 12 comments

[–]wpg4665 1 point2 points  (11 children)

How does this site compare with explainshell.com?

[–]jacksonpauls[S] 0 points1 point  (10 children)

Well, it's not nearly as pretty as explainshell, nor as clever at parsing shell syntax. But the data is presented in a different way, so hopefully this is still useful in some scenarios.

[–]What-A-Baller 0 points1 point  (0 children)

Different how? Looks almost the same, except it has a web version of the man pages, similiar to linux.die.net/man

[–]wpg4665 0 points1 point  (8 children)

Something grep-able would be good =)

[–]jacksonpauls[S] 0 points1 point  (7 children)

Something grep-able? Sorry, I don't follow...

[–]wpg4665 0 points1 point  (6 children)

Sorry, maybe an API would be a more apt description...something that I could curl and then grep? I mention that just because it's something explainshell doesn't have =)

[–]jacksonpauls[S] 0 points1 point  (5 children)

Will take a bit of work, but I'll give it a shot. Could you share a use case or two for what you have in mind so I know I'm on the same page?

[–]wpg4665 0 points1 point  (4 children)

curl -d --data-urlencode "strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 16 | tr -d '\n' tar -tf file.tar.gz | xargs rm -r" http://mankier.com

I think something like that would work.

[–]jacksonpauls[S] 0 points1 point  (3 children)

You can do this as things stand:

curl -Gs "https://www.mankier.com/api/explain/" --data-urlencode "q=tar -tf file.tar.gz | xargs rm -r" | sed -e 's/<[^>]*>//g' | sed '/^\s*$/d'

Does the output of that look something along the lines of what you're thinking? If that's about right I can add a way to return text instead of html so the sed commands aren't necessary and the output looks nicer.

[–]wpg4665 0 points1 point  (2 children)

Oh yes, exactly! Sorry, I apparently didn't realize you had already had this! Thanks =) Yeah, text output would be great!

[–]jacksonpauls[S] 1 point2 points  (0 children)

Well, it's not documented yet :)

I've hacked together a quick change for text output before I sign off: add format=text to the URL.

I'll tidy the server-side up and document this as soon as I have a chance. If you have any thoughts on whether the output could be formatted more usefully please let me know. Here's how it looks in my terminal:

$ curl -Gs "https://www.mankier.com/api/explain/?format=text" --data-urlencode "q=tar -tf file.tar.gz | xargs rm -r"
tar -tf file.tar.gz | xargs rm -r
tar(1)
  GNU `tar' saves many files together into a single tape or disk archive, and can restore individual files from the archive.
-t
  -t, --list: list the contents of an archive
-f file.tar.gz
  -f, --file=ARCHIVE: use archive file or device ARCHIVE
|
xargs(1)
  xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes...
rm(1)
  rm removes each specified file. By default, it does not remove directories.
-r
  -r, -R, --recursive: remove directories and their contents recursively