/lorelai

✍ Generate Lorem Ipsum like a pro

Primary LanguageGoMIT LicenseMIT

Lorelai Lines Of Code PkgGoDev CodeQL Go Report Card

A package and command line tool to generate Lorem ipsum.

Cover

Blog explaining this package

Install

go get github.com/UltiRequiem/lorelai/pkg

Examples

Generating Text

func printTonsOfText() {
	for i := 0; i < 10; i++ {
          fmt.Println(lorelai.Paragraph())
	}
}

Convenience Utilities

func sayHi() {
	fmt.Println(fmt.Sprintf("My, my name is: %s.", lorelai.Word()))
	fmt.Println(fmt.Sprintf("My email address is %s", lorelai.Email()))
	fmt.Println(fmt.Sprintf("My website is: %s", lorelai.URL()))
}

For more examples check the examples directory.

Documentation

This package exports 8 functions:

  • Word: Returns 1 Word

E.g: "sodales", "phasellus" , "diam", etc.

E.g: "Varius sed imperdiet amet laoreet ex sapien placerat.", etc.

E.g: "Nisi lacinia ante non nunc eros nibh mattis enim orci ante in ornare accumsan iaculis vel..."

  • FormattedLoremWords: It receives a number and returns a string with the number of words you have indicated. The first letter will be capital and the sentence will end with a dot.

E.g: "Libero malesuada duis massa luctus.", "Curabitur hendrerit sed.", "Ligula.", etc.

  • LoremWords: It receives a number and returns a string with the number of words you have indicated.

E.g: "arcu", "blandit porttitor a scelerisque", "donec justo lacinia", etc.

E.g: "neque.net", "arcu.org" , "lorem.io", etc.

  • URL: Returns an URL

E.g: "https://pellentesque.org", "https://id.io" , "https://efficitur.com", etc.

  • Email: Retuns an email address

E.g: "bibendum@id.pe", "ornare@duis.pe" , "quisque@faucibus.org", etc.

CLI Tool

Installation

go install github.com/UltiRequiem/lorelai@latest

Or use a binary from releases.

Usage

If you don't pass any flag or you pass the help flag:

 lorelai 1.0.0
 Easily generate Lorem Ipsum on command line.

 -h or --help           Print this

 -w or --word           Number of words to print

 -p or --paragraph      Number of paragraphs to print

 -s or --sentences      Number of sentences to print

 -o or --output         If passed it will try to put the output in a file

 --url                  A random URL

 --email                A random Email Address

 --color                Print the output with colors?

  Examples:
      lorelai -w 55           # Will print 55 words
      lorelai -p 5            # Will print 5 paragraphs
      lorelai -s 5 --output b # Will write 5 sentences on file b if possible
      lorelai -w 55 -s 5      # Will print 55 words and 5 sentences

 If you need more help, found a bug or want to suggest a new feature:
 https://github.com/UltiRequiem/lorelai

License

This project is licensed under the MIT License.