cats

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2021 License: MIT Imports: 2 Imported by: 0

README

cats

CLI tool that downloads a random cat jpeg from The Cat API, implemented in Go.

Pull requests to fix bugs or add features are welcome :)

Installation

First install Go.

Then, to install the binary to your current directory, run the following command:

GOBIN="$(pwd)" GOPATH="$(mktemp -d)" go get github.com/simmonsritchie/cats

Usage

Return a random image as a byte stream to Stdout:

cats

Return a random image of an American Bobtail:

cats -b abob

Return a random image of an Egyptian Mau and save to file 'meow.jpg':

cats -b emau -o meow.jpg

Options

  -b string
        Provide a cat breed ID to only return cats of a specific breed
  -breeds
        Provides an index of available cat breed IDs
  -o string
        Output path for cat image (default "./cat.jpg")
  -v    log runtime messages to stdout

Example cats

screenshot

screenshot

screenshot

API key

By default, cats fetches data from The Cat API without an API key. The Cat API allows requesters to return a small amount of data without using one, which is all that this tool needs.

However, heavy users of cats may encounter rate limiting without use of an API key. You can sign up for a key for free on the website of The Cat API. You can then provide it to cats as an environment variable before execution.

On Mac/linux, run the following command, replacing 'xxxx' with your key:

export API_KEY=xxxx

Or you can set it in an .env file in the same directory as the binary:

// .env file

API_KEY=xxxx

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL