snailshell

Crates.iosnailshell
lib.rssnailshell
version0.3.1
sourcesrc
created_at2022-07-30 04:06:40.014407
updated_at2022-08-01 17:53:43.943156
descriptionLibrary for making terminal text display with pleasant RPG-style animations.
homepagehttps://github.com/ElfWitch/snailshell
repositoryhttps://github.com/ElfWitch/snailshell
max_upload_size
id635320
size24,797
(ElfWitch)

documentation

README

🐌 snailshell

MIT LICENSE VERSION DOCS DOWNLOADS

A tiny library and application for animating text in the terminal.

🪄 It's so easy to add some flair to your text RPGs or console programs. 🪄

demo

☝️ From Fun Stuff example. (obviously looks smoother in an actual terminal)

Compatibility

Compatible with EVERYTHING! 🥳

Snailshell works with any type which implements Display, so literally everything that you would normally use with print!(), println!(), or format!() just works! This includes colored text from other libraries such as Crossterm.

👩‍🏫 Examples


Basic

use snailshell::*;

// It's dead simple.
snailprint("hello, friend :)");

Custom Fixed Duration

snailprint_d("This whole message will print in half a second regardless of the size.", 0.5);

Refresh Rate

// This is optional. Default fps is 60.
// All subsequent snailprint functions will use this fps.
set_snail_fps(30);

🐌🖥️ Snailshell Standalone:

You can also use snailshell from the command line.

cli demo

Useful for making shell scripts and videos!

Installation:

cargo install snailshell

Usage:


snailshell [OPTIONS] <TEXT>

ARGS:
<TEXT>    Text you want to animate

OPTIONS:
-d, --duration <DURATION>    How long the text should animate for
-f, --fps <FPS>              Refresh rate of animation
-h, --help                   Print help information
-s, --speed <SPEED>          Constant speed of chars per second to render. Conflicts with duration

Example

Simple:

snailshell "text you want to animate"

Animates the contents of textfile over 2 seconds:

cat textfile | snailshell -d 2.0

If you just run 'snailshell' without any any arguments, it will expect text to be piped into it and won't respond to newlines. Just press Ctrl-C.

📖 License


This crate is licensed under the MIT license.

Commit count: 28

cargo fmt