A Script A Day – WhatIs – Day 03/05

Day 3’s script: `whatis`: A wikipedia summary lookup.  It’s operation is pretty straightforward, you give it a search to do and it’ll perform the lookup for you.  If you hit a redirect it should follow it, at least as of time of writing this. (Edit whatis_extract.xsl in the resources directory if it breaks.)Output isn’t word-wrapped, though I may fix that later.

For example:

./sd1.sh whatis Touhou

At time of writing, the above command follows a redirect to Touhou Project and then displays the first section containing the overall description of the Touhou Project series. Often tables are included in the first section that end up looking kind of ugly, but I’ve not decided on whether or not I want to remove them.

If there’s no exact title match, the script will instead perform a search and try to list some potential alternative searches. An example of this can be seen in the screenshot attached to this post. To check out the code, as with the other script-a-day projects, check out the repo.

WhatIs

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>