Skip to content

robole/xkcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xkcd logo
xkcd

Read xkcd from the comfort of your terminal


xkcd is probably the most popular webcomic with devs. It only seems right that you can read it from the comfort of your terminal via a xkcd command.

xkcd command on terminal

Requirements

Here is a summary of the dependencies:

  • Kitty terminal. Kitty shows images via the icat kitten which is included in the default installation.
  • ImageMagick is used by Kitty under hood as far as I know.
  • The utilties you find in most unix-like systems: curl, grep, cut, and perl.

If you do not want to use Kitty, I believe iTerm2 has similar functionality with its imgcat script. It is a minor change to adapt the script to use that instead.

Install

It is a shell script. You can run it as ./xkcd when the file is in the current working directory.

It is preferable to move it to an executable location and be able to run it using xkcd anywhere e.g. move the xkcd file to /usr/local/bin on linux.

Usage

Usage: xkcd [-l|--latest] [-r|--random] [-h|--help]
  -h, --help          	Print the help page.
  -l, --latest        	Show the latest comic.                                   
  -r, --random        	Show a random comic.                                  

For example, to show a random comic, run the command xkcd --random.

Versions

I wrote 2 versions of this with the same interface:

  1. This is the version that scrapes the webpages (main branch).
  2. The alternative version uses the web api, go to the json branch to check that out.

I discuss the code in this article -- Read XKCD in the terminal with some bash magic.

Appreciate

You can show your appreciation by:

  1. Buying me a coffee or sponsoring me. This will offer me encouragement to continue, and can provide a path to dedicating more time to open-source in the future.
  2. Starring the repo 🌟. This will help other people find this.

Thank you! 🙏

Attribution

XKCD is licensed under a Creative Commons Attribution-NonCommercial 2.5 License.

About

Read XKCD from the comfort of your terminal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages