XKCD API (and CLI)
Go to file
jolheiser 09ddc8b473
Update README
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2021-05-04 22:12:01 -05:00
cmd/xkcd Initial commit 2021-05-04 22:10:30 -05:00
.gitignore Initial commit 2021-05-04 22:10:30 -05:00
client.go Initial commit 2021-05-04 22:10:30 -05:00
go.mod Initial commit 2021-05-04 22:10:30 -05:00
LICENSE Initial commit 2021-05-04 22:10:30 -05:00
Makefile Initial commit 2021-05-04 22:10:30 -05:00
README.md Update README 2021-05-04 22:12:01 -05:00
xkcd_test.go Initial commit 2021-05-04 22:10:30 -05:00
xkcd.go Initial commit 2021-05-04 22:10:30 -05:00

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