Skip to content

Go utility library for generating Lorem Ipsum text

License

Notifications You must be signed in to change notification settings

derektata/lorem

Repository files navigation

lorem

lorem is a Go utility library for generating Lorem Ipsum text.

Todo List

  • - Build library code
    • - Customize how many words per sentence
    • - Customize how many sentences per paragraph
    • - Customize the chance of a comma being added to a sentence
  • - Build simple CLI
  • - Build Neovim Plugin
    • - Bootstrap binary for Neovim Plugin
    • - Create ':LoremIpsum' command w/ args
    • - Tab completion between words and paragraphs
    • - Integrate with completion engine
  • - Write out unit tests for library
    • - Write out tests for Generator
    • - Write out tests for CLI
    • - Write out tests for Neovim Plugin

Installation

To install the library, run the following command:

go get -u github.com/derektata/lorem

If you would like the CLI, grab the latest release from the Latest Releases.

Usage as a library

package main

import (
    lorem "github.com/derektata/lorem/ipsum"
)

func main() {
    // Create a new generator
    g := lorem.NewGenerator()
    g.WordsPerSentence = 10 // Customize how many words per sentence
    g.SentencesPerParagraph = 5 // Customize how many sentences per paragraph
    g.CommaAddChance = 3 // Customize the chance of a comma being added to a sentence

    // Generate words
    words := g.Generate(100)
    fmt.Println(words)

    // Generate paragraphs
    paragraphs := g.GenerateParagraphs(3)
    fmt.Println(paragraphs)
}

Usage as a CLI

Usage of lorem:
  -p, --paragraphs int   number of paragraphs to generate
  -w, --words int        number of words to generate (default 100)

Examples:
  $ lorem -p 5
  $ lorem -w 500

Usage as a Neovim Plugin

Make sure you have the binary from the Latest Releases in your PATH, then:

Installing the plugin via Lazy:

{ 
  "derektata/lorem",
  config = function()
    require("lorem")
  end
},

Usage in Editor:

:LoremIpsum 5 <tab>

License

MIT License