Git Product home page Git Product logo

lipsum-cli's Introduction

lipsum-cli

lipsum-cli is a small terminal application written in Rust language. It's used for generating pseudo-Latin lorem ipsum filler text in terminal.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat…

This application uses lipsum library to generate text.

It also has the ability to generate text from a file or stdin.

INSTALLATION

Using Cargo

cargo install lipsum-cli

Using Homebrew

brew tap xlith/lipsum-cli
brew install lipsum-cli

USAGE

lipsum-cli [OPTIONS]

OPTIONS:
    -f, --file <FILE>                  File input for the custom source. This has priority to stdin.
                                       If not specified, stdin is used
    -h, --help                         Print help information
    -t, --text-source <TEXT_SOURCE>    Text source to choose from. Ignored if stdin or `-f` is used
                                       [default: liber-primus] [possible values: liber-primus,
                                       lorem-ipsum]
    -V, --version                      Print version information
    -w, --words <WORDS>                Count of words to generate. Default is 5 if text source is
                                       not liber-primus
    -l, --words-per-line               Count of words after a new line is inserted. By default deactivated
                                       Zero is the same as deactivated
                                       No new line will come after the last word

EXAMPLES

This will generate a string using Liber Primus like Grate Meminit et Praesentibus which should be suitable for use in a document title for section heading.

$ lipsum-cli 
Dolore sed in his Rebus Instructus

This will generate a string of 5 words from a file (lorem-ipsum.txt)

$ lipsum-cli --file ./start-wars.txt
Weapon, the DEATH STAR, an.

This will generate a string of 5 words from stdin

$ cat start-wars.txt | lipsum-cli
The Empire’s sinister agents, Princess.

This will generate a string of 10 words from a file (lorem-ipsum.txt)

$ lipsum-cli --file star-wars.txt --words 10
Aboard her starship, custodian of the stolen plans that can.

This will generate a string of 10 words from stdin

$ cat star-wars.txt | lipsum-cli --words 10
The stolen plans that can save her people and restore.

This will generate a string of 10 words using the lorem ipsum example filler text beginning with “Lorem ipsum dolor sit amet”

$ lipsum-cli --text-source lorem-ipsum --words 10
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do.

This will generate a string of 20 words with a new line after 4th word.

$ lipsum-cli --words 30 --words-per-line 4
Multavit. -- Si sine
causa, nollem me ab
eo dissentiunt, sed certe
non probes, eum quem
ego arbitror unum vidisse
verum maximisque erroribus animos
hominum liberavisse et omnia
tradidisse, quae.

CONTRIBUTING

This is my first Rust project, so I'm sure there are some mistakes. If you have any questions, comments or ideas, please feel free to submit a pull request or open an issue.

Contribution Guidelines:

  • Fork the repository on GitHub
  • Create a new branch
  • Commit your changes
  • Push your branch to GitHub
  • Open a pull request

LICENSE

This project is licensed under the MIT license. Contributions will be accepted under the same license.

Release History

This is a changelog describing the most important changes per release.

Version 0.3.0 — 02.03.2023

  • Add a new option (words-per-line)
  • Fix readme typo

Version 0.2.2 — 24.02.2023

  • update dependencies
  • update creates.io metadata and readme

Version 0.2.1 — 21.02.2023

  • Small refactor for more idiomatic Rust
  • Fix bug in which --words input was overridden

Version 0.2.0 — 30.09.2022

  • Refactor code for better readability
  • Fix bug when stdin input length is 0
  • Update dependencies

Version 0.2.0 — 19.02.2022

  • Completely rewritten and redesigned the application to be more modular and easier to use.
  • Fix lots of text and typos.
  • Added unit tests.

Version 0.1.0 — 20.02.2022

  • Initial release

lipsum-cli's People

Contributors

boolpurist avatar chrisrenfrow avatar xlith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lipsum-cli's Issues

Problematic tty options

Hi. Thanks for sharing this project!

I'm trying to use this together with rofi and I found there is a problem when using lipsum-cli with pipes.

The docs says:

cat start-wars.txt | lipsum-cli
The Empire’s sinister agents, Princess.

But if you try to use lipsum-cli with xargs

echo "lipsum-cli -w 10" | xargs -i /bin/bash -c "{}"

You always get an empty response. I think this is because: if atty::isnt(Stream::Stdin) sets the input_source to stdin, and there is no stdin.

I think a possible solution would be change the precedence described here:

-t, --text-source <TEXT_SOURCE> Text source to choose from. Ignored if stdin or -f is used

So if you specify a -t value, it won't read from stdin, and pipes can be used freely.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.