DadJokes

main

A command-line utility for macOS to display a dad joke.
SlaunchaMan/DadJokes

DadJokes

DadJokes is a command-line utility for macOS to retrieve dad jokes from https://icanhazdadjoke.com. To get a dad joke, run the executable:

$ dadjokes
How was the snow globe feeling after the storm? A little shaken.

The easiest way to get the binary from the source is to just use Swift; the swift run command will build and run automatically:

$ swift run
Two peanuts were walking down the street. One was a salted.

Command-Line Arguments

Feeling impatient? The -t argument (or --timeout) allows you to specify a timeout in seconds:

$ dadjokes -t 2
How can you tell a vampire has a cold? They start coffin.

If you want to change the URL that DadJokes uses to your own super-secret stash of dad jokes, use the -u (or --url) command:

$ dadjokes -u "https://example.com"
This is a super-secret dad joke!

Development

DadJokes is written in Swift using Appleā€™s ArgumentParser library for parsing command-line arguments and Alamofire for networking. For testing, it uses XCTest, OHHTTPStubs, and GCDWebServer.

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

Last updated: Fri Jan 19 2024 07:31:42 GMT-1000 (Hawaii-Aleutian Standard Time)