#fun #language #cli #command-line

bin+lib lear

Prints a random passage from King Lear. For when you meant to type "clear"

2 unstable releases

0.2.0 Oct 9, 2021
0.1.0 Oct 9, 2021

#130 in #fun

MIT/Apache

800KB
673 lines

Lear: A Shakespearean Command Line Utility

Lear is a command line “utility” that you can use to amuse yourself and your friends. Whenever you mistype clear into the terminal, lear will dutifully print out a passage from everyone’s favorite tragedy about a mad king.

This idea was loosely inspired by sl (Steam Locomotive), Fortune, and all of the other weird command line scripts out there.

Usage

To get started, type lear into the console (preferably by accident).

a demonstration of lear, with a passage from act 3 scene 2 printed to the console

To print a specific passage, use the quote subcommand. It accepts the act, scene, starting line, and ending line as positional arguments. This example quotes lines 7–8 from Act 3, Scene 3.

$ lear quote 3 3 7 8
EDMUND
    Most savage and unnatural!

GLOUCESTER
    Go to; say you nothing. There's a division betwixt
    ...

                                                            (Lr. 3.3.7-8)

You can use the contents command to print a table of contents, which will show you which acts and scenes are available, as well as how many lines they contain.

$ lear contents
 Act  Scene  Lines
-------------------
  1     1     332
        2     191
        3     27
...

Installation

If you have cargo installed on your machine already, lear can be installed with

$ cargo install lear

A homebrew installation is hopefully coming soon.

Contributing

If you would like to contribute to this tool, please open an issue or submit a pull request

Dependencies

~2.4–4MB
~68K SLoC