XKCD API (and CLI)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
John Olheiser 09ddc8b473
Update README
6 months ago
cmd/xkcd Initial commit 6 months ago
.gitignore Initial commit 6 months ago
LICENSE Initial commit 6 months ago
Makefile Initial commit 6 months ago
README.md Update README 6 months ago
client.go Initial commit 6 months ago
go.mod Initial commit 6 months ago
xkcd.go Initial commit 6 months ago
xkcd_test.go Initial commit 6 months ago

README.md

XKCD

An XKCD API and CLI.

You can find the API information on the about page near the bottom.

Library

package main

import (
	"context"
	
	"gitea.com/jolheiser/xkcd"
)

func main() {
	client := xkcd.New()
	comic, err := client.Current(context.Background())
	if err != nil {
		panic(err)
	}
	
	// Do stuff...
}

CLI

Build the CLI if you think it's useful.

If no comic number is given, it grabs the current comic.

./xkcd [--image] [--out=<path>] [<comic>]

  • --image - Get the image from the returned image URL. Pipe it wherever you want, or...
  • --out <path> - A path to a file to store the response (or image)

License

MIT