https://github.com/bsljth/printo
printo is a Nim package that can configure the timing of printing text onto the console.
https://github.com/bsljth/printo
console echo nim nim-lang nimble nimlang print
Last synced: about 1 month ago
JSON representation
printo is a Nim package that can configure the timing of printing text onto the console.
- Host: GitHub
- URL: https://github.com/bsljth/printo
- Owner: bsljth
- License: mit
- Created: 2023-07-14T20:48:08.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-18T07:00:35.000Z (over 1 year ago)
- Last Synced: 2023-10-19T07:42:42.850Z (over 1 year ago)
- Topics: console, echo, nim, nim-lang, nimble, nimlang, print
- Language: Nim
- Homepage:
- Size: 146 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## printo
`printo` (pronounced "print-o") is a Nim package that can be used to configure the timing of printing text on the terminal. There are 4 different modes to choose from. Printo can be used in any Nim application that supports version 1.6.14 and above.
However, since `printo` is a simple library that uses only basic Nim constructs, applications written in earlier versions of Nim should also be able to use it seamlessly.
### How to use printo
#### Installation
Since `printo` has not yet been added to the `nimble` directory, you'll have to install it from the repository.```
$ nimble install https://bitbucket.org/pyfyclan/printo.git
```
After it is installed, add the `printo` to your project's `.nimble` file using the `requires` keyword:
```nim
requires "printo >= 0.1.0"
```Then, using `printo` in your project is quite easy. You can import `printo` into any file within your project. There is only one proc that you actually use: `printo`. Just import that proc and you are good to go; really.
The `printo` proc only requires three arguments to work:
1. The text to be printed.
2. The mode of printing (detailed below).
3. The time (in milliseconds) gap between each element while printing. An element could be a word or a character.#### Modes
Currently, printo supports four modes of printing. They are detailed in the following table:| Mode | Description |
|------------|-----------------------------------------------------------------------|
| lblsl | Print text letter by letter on the same line. |
| wbwsl | Print text word by word on the same line. |
| lblnl | Print text letter by letter on a new line per letter. |
| wbwnl | Print text word by word on a new line per word. |The actual usage is as follows:
```nim
from printo import printolet txt: string = "Lorem ipsum whatever you got."
let mode = "lblsl"
let time = 100 # remember that this value is in millisecondsprinto(txt, mode, time)
```