#text #linux #terminal #io #unicode

bin+lib term-basics-linux

A simple crate with basic functionality for terminal applications

6 releases

✓ Uses Rust 2018 edition

0.2.1 Aug 31, 2019
0.2.0 Jul 12, 2019
0.1.3 Jun 11, 2019

#88 in Command-line interface

Download history 45/week @ 2019-06-07 13/week @ 2019-06-14 21/week @ 2019-06-21 4/week @ 2019-06-28 20/week @ 2019-07-05 25/week @ 2019-07-12 2/week @ 2019-07-19 6/week @ 2019-07-26 19/week @ 2019-08-02 11/week @ 2019-08-09 10/week @ 2019-08-16 10/week @ 2019-08-23

64 downloads per month

MIT license

27KB
450 lines

Crate API

term-basics-linux

Rust crate libary that provides simple and basic terminal functionality for linux. (Work In Progress!)

usage

As the name is quite long, everything is put into module tbl, which is an acronym. To import this mod: use term_basics_linux::tbl; After that you can use the crate: let name = tbl::prompt("type your name: "); It is recommended to use the tbl:: notation, just like you would not use using namespace std; in c++.

examples

The main feature of this crate is the input field, supporting editing your input text with function keys like backspace, delete, home, end, arrows. tbl::println(tbl::input_field());

let name = tbl::prompt("type your name: ");
tbl::print("Your name: ");
tbl::println(name);

It also supports simple user defined colours and text styles: tbl::print_cols_style("very nice", tbl::UserColour::Yellow, tbl::UserColour::Cyan, tbl::TextStyle::Bold); Another feature is getch() which returns the characters from stdin with out the user having to press enter. It can be very useful and is not available by default in rust.

design

This crate is very simple by design, as it does simple things the code should not be complicated. It is made for linux, as it is a crate for terminal applications. With MacOS being a unix based OS and windows having a linux kernel build in, it should be kind of portable-ish. The crate only supports user defined colours by design. First of all it keeps this crate simple. Secondly i think you should only use user defined colours. If you use them you application will match with the enviroment and other applications. The user chose there colours for a reason and nobody likes inconsistent colours across applications. With all the fuss lately around GTK and distro's breaking themes for applications, this problem is easy to avoid with terminal applications by using the user's colours.

contribution

You can always create issues and pull requests on github. You can aslo mail to codybloemhard@gmail.com

links

This readme is used on multiple sites so some links might be redundant.

Dependencies

~1.5MB
~29K SLoC