xkcd in your console
CPAN (stable release) | GIT (dev release) |
I love xkcd; everybody does. What I don’t like is how you have to move the mouse cursor over the picture to see the hover text, which often is necessary for fully understanding the comic. Since I don’t use a mouse, for several reasons, I had to curl and grep; not very userfriendly, eh.
App::xkcd
xkcd is a command-line interface to xkcd.com.
View, download and enjoy comics straight from the comfortable shell. The mouse-over text is displayed when the image-viewing application exits for maximum amusement. Called with zero arguments, the latest xkcd comic is displayed. The -c flag takes an (preferably valid) integer that corresponds to that particular xkcd comic number. The - a flag only displays the mouse-over text, while the - d flag downloads the comic to location.
A typical run might look like this:
> xkcd
Latest XKCD:
It is not our fault we caught a group on their way home from a geography bee.
And they taught us that Uzbekistan is one of the worlds two doubly-landlocked
countries!
> xkcd -c 183 -a
I am not making this rule up.
Although my mom wants you all to know it made perfect sense at the time.
> xkcd -d .
http://imgs.xkcd.com/comics/world_according_to_americans.png
=> ./world_according_to_americans.png
> xkcd -c 193 -d .
http://imgs.xkcd.com/comics/the_perfect_sound.png
=> ./193-the_perfect_sound.png
Installation
For the ‘stable’ version:
cpan App::xkcd
or, for the development version:
cpan WWW::Mechanize
git clone git://github.com/trapd00r/xkcd.git
cd xkcd
perl Makefile.PL && make && su -c 'make install'
Prerequisites
The Perl module WWW::Mechanize needs to be installed.
To view the xkcd comics in X, feh or display (from the ImageMagick suite) is also required.
Options
-c, --comic comic number
-l, --latest show the latest xkcd comic
-a, --alt show the 'mouse over' text
-d, --download download the comic to DESTINATION
-h, --help show the help and exit
-v, --version show version info and exit
-m, --man show the documentation and exit