updated doc

This commit is contained in:
TimonPost 2018-08-25 12:00:39 +02:00
parent 26060a56eb
commit 410009dc46
6 changed files with 36 additions and 35 deletions

View File

@ -1,7 +1,7 @@
[package] [package]
name = "crossterm" name = "crossterm"
version = "0.4.0" version = "0.4.0"
authors = ["T Post <timonpost@hotmail.nl>"] authors = ["T. Post"]
description = "An crossplatform terminal library for manipulating terminals." description = "An crossplatform terminal library for manipulating terminals."
repository = "https://github.com/TimonPost/crossterm" repository = "https://github.com/TimonPost/crossterm"
documentation = "https://docs.rs/crossterm/" documentation = "https://docs.rs/crossterm/"

View File

@ -1,6 +1,6 @@
# Crossterm | cross-platform terminal manipulating library written in rust. # Crossterm | cross-platform terminal manipulating library written in rust.
[![Latest Version](https://img.shields.io/crates/v/crossterm.svg)](https://crates.io/crates/crossterm) | [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) | [![docs.rs](https://docs.rs/crossterm/badge.svg)](https://docs.rs/crossterm/) | [Examples](https://github.com/TimonPost/crossterm/tree/master/examples) | [Changelog](https://github.com/TimonPost/crossterm/blob/master/docs/UpgradeManual.md) | [Release Nodes](https://github.com/TimonPost/crossterm/tree/master/docs) [![Latest Version](https://img.shields.io/crates/v/crossterm.svg)](https://crates.io/crates/crossterm) | [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) | [![docs.rs](https://docs.rs/crossterm/badge.svg)](https://docs.rs/crossterm/) | [Examples](https://github.com/TimonPost/crossterm/tree/master/examples) | [Changelog](https://github.com/TimonPost/crossterm/blob/master/docs/UpgradeManual.md) | [Release Nodes](https://github.com/TimonPost/crossterm/blob/master/docs/ReleaseNotes.md)
|----|----|----|----|----|---- |----|----|----|----|----|----
Ever got disappointed when a terminal library for rust was only written for unix systems? Ever got disappointed when a terminal library for rust was only written for unix systems?
@ -17,9 +17,10 @@ This crate supports all unix and windows terminals down to windows 7 (not all te
- [Useful links](https://github.com/TimonPost/crossterm#useful-links) - [Useful links](https://github.com/TimonPost/crossterm#useful-links)
- [Features](https://github.com/TimonPost/crossterm#features) - [Features](https://github.com/TimonPost/crossterm#features)
- [Examples](https://github.com/TimonPost/crossterm#examples) - [Examples](https://github.com/TimonPost/crossterm#examples)
- [Crossterm Wrapper](https://github.com/TimonPost/crossterm#crossterm-wrapper--see-more) - [Crossterm Wrapper](https://github.com/TimonPost/crossterm#crossterm-type--see-more)
- [Styling](https://github.com/TimonPost/crossterm#styled-font--see-more) - [Styling](https://github.com/TimonPost/crossterm#crossterm-type--see-more)
- [Cursor](https://github.com/TimonPost/crossterm#cursor--see-more) - [Cursor](https://github.com/TimonPost/crossterm#cursor--see-more)
- [Input](https://github.com/TimonPost/crossterm#input--see-more)
- [Terminal](https://github.com/TimonPost/crossterm#terminal--see-more) - [Terminal](https://github.com/TimonPost/crossterm#terminal--see-more)
- [Tested Terminals](https://github.com/TimonPost/crossterm#tested-terminals) - [Tested Terminals](https://github.com/TimonPost/crossterm#tested-terminals)
- [How it works](https://github.com/TimonPost/crossterm#how-it-works) - [How it works](https://github.com/TimonPost/crossterm#how-it-works)
@ -54,16 +55,16 @@ use self::crossterm::cursor::*;
// this mudule is used for terminal related actions // this mudule is used for terminal related actions
use self::crossterm::terminal::*; use self::crossterm::terminal::*;
// this mudule is used for input related actions // this mudule is used for input related actions
use self::crossterm::terminal::*; use self::crossterm::input::*;
``` ```
## Useful Links ## Useful Links
- Code [documentation](link). - Code [documentation](https://docs.rs/crossterm/).
- Code [Examples]() (see [branches](LINK_TO_BRANCHES) for previous versions) - The [Cargo Page](https://crates.io/crates/crossterm)
- [Cargo Page](https://crates.io/crates/crossterm) - More real live [examples](https://github.com/TimonPost/crossterm/tree/master/examples/program_examples)
- [Program Examples](https://github.com/TimonPost/crossterm/tree/master/examples/program_examples) - Detailed [examples](https://github.com/TimonPost/crossterm/tree/master/examples)
# Features # Features
These are the features from this crate: These are the features from this crate:
@ -94,14 +95,11 @@ These are the features from this crate:
- Read async - Read async
- Read async until - Read async until
- Exit the current process. - Exit the current process.
- Everything is multithreaded (Send, Sync)
- Detailed documentation on every item. - Detailed documentation on every item.
- Crossplatform - Crossplatform
## Examples ### Crossterm Type | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/some_types/mod.rs)
For detailed examples of all Crossterm functionalities check the [examples](https://github.com/TimonPost/crossterm/tree/master/examples) directory.
### Crossterm Type | [see more](Link)
This is a wrapper for all the modules crossterm provides like terminal, cursor, styling and input. This is a wrapper for all the modules crossterm provides like terminal, cursor, styling and input.
```rust ```rust
@ -119,7 +117,7 @@ let style = crossterm.style("Black font on Green background color").with(Color::
style.paint(&screen); style.paint(&screen);
``` ```
### Styled Font | [see more](Link) ### Styled Font | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/color/mod.rs)
This module provides the functionalities to style the terminal cursor. This module provides the functionalities to style the terminal cursor.
```rust ```rust
use crossterm::style::{Color, style}; use crossterm::style::{Color, style};
@ -161,7 +159,7 @@ style("RGB color (10,10,10) ").with(Color::Rgb {
style("ANSI color value (50) ").with(Color::AnsiValue(50)).paint(&screen); style("ANSI color value (50) ").with(Color::AnsiValue(50)).paint(&screen);
``` ```
### Cursor | [see more](LINK) ### Cursor | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/cursor/mod.rs)
This module provides the functionalities to work with the terminal cursor. This module provides the functionalities to work with the terminal cursor.
```rust ```rust
@ -206,10 +204,10 @@ cursor.blink(true)
``` ```
### Input | [see more](LINK) ### Input | [see more](https://github.com/TimonPost/crossterm/tree/master/examples/input)
This module provides the functionalities to work with terminal input. This module provides the functionalities to work with terminal input.
Check [this](link) for handling async input. Check [this](https://github.com/TimonPost/crossterm/blob/master/examples/input/keyboard/async_input.rs) for handling async input.
```rust ```rust
@ -232,7 +230,7 @@ let mut input = input(&screen);
``` ```
### Terminal | [see more](LINK) ### Terminal | [see more](https://github.com/TimonPost/crossterm/blob/master/examples/terminal/terminal.rs)
This module provides the functionalities to work with the terminal in general. This module provides the functionalities to work with the terminal in general.
```rust ```rust
@ -272,7 +270,7 @@ terminal.exit();
terminal.write("Some text\n Some text on new line"); terminal.write("Some text\n Some text on new line");
``` ```
Check these links: [AlternateScreen](https://github.com/TimonPost/crossterm/blob/master/examples/Crossterm%200.3.0/terminal/alternate_screen.rs) and [RawScreen](https://github.com/TimonPost/crossterm/blob/master/examples/Crossterm%200.3.0/terminal/raw_mode.rs) for information about how to work with these features. Check these links: [AlternateScreen](https://github.com/TimonPost/crossterm/blob/master/examples/terminal/alternate_screen.rs) and [RawScreen](https://github.com/TimonPost/crossterm/blob/master/examples/terminal/raw_mode.rs) for information about how to work with these features.
## Tested terminals ## Tested terminals
@ -308,7 +306,7 @@ I highly appreciate it when you are contributing to this crate.
Also Since my native language is not English my grammar and sentence order will not be perfect. Also Since my native language is not English my grammar and sentence order will not be perfect.
So improving this by correcting these mistakes will help both me and the reader of the docs. So improving this by correcting these mistakes will help both me and the reader of the docs.
Check [Contributing](link) for more info about branches and code architecture. Check [Contributing](https://github.com/TimonPost/crossterm/blob/master/docs/Contributing.md) for more info about branches and code architecture.
## Authors ## Authors

View File

@ -1,10 +1,13 @@
# Features / Fixes in crossterm 0.4.0 # Features / Fixes in crossterm 0.4.0
- Input support (read_line, read_char, read_async, read_until_async) - Input support (read_line, read_char, read_async, read_until_async)
- Styling module improved - Styling module improved
- This create supports multithreading (`Send`) - Everything is multithreaded (`Send`, `Sync`)
- Performance enhancements: removed mutexes, removed state manager, removed context type removed unnecessarily RC types. - Performance enhancements: removed mutexes, removed state manager, removed context type removed unnecessarily RC types.
- Bug fix resetting console color. - Bug fix resetting console color.
- Bug fix whit undoing raw modes. - Bug fix whit undoing raw modes.
- More correct error handling.
- Overall commend improvement.
- Overall refactor of code.
# Features in crossterm 0.3.0 # Features in crossterm 0.3.0

View File

@ -19,6 +19,4 @@ use std::io::Write;
use std::{thread,time}; use std::{thread,time};
fn main() fn main()
{ {
::crossterm::terminal::terminal(&::crossterm::Screen::default()).terminal_size();
thread::sleep(time::Duration::from_millis(2000));
} }

View File

@ -7,15 +7,18 @@ The programs are:
- First depth search: - First depth search:
This is an search algorithm implemented visually. This program uses the following functionalities: cursor movement, coloring, alternate screen and terminal clearing. This is an search algorithm implemented visually. This program uses the following functionalities: cursor movement, coloring, alternate screen and terminal clearing.
To run this use `cargo run` in the directory of first depth search.
- Snake - Snake
This is a snake game implemented with this library. This is a snake game implemented with this library.
To run this use `cargo run` in the directory of snake.
- Command Bar: - Command Bar:
This is a terminal application where multiple threads write to the output while you can enter commands asynchronously. This is a terminal application where multiple threads write to the output while you can enter commands asynchronously.
To run this use `cargo run --example command_bar`
- Logging: - Logging:
This is an async logging program to demonstrate asynchronous logging with an queue. This is an async logging program to demonstrate asynchronous logging with an queue.
To run this use `cargo run --example logging`

View File

@ -79,8 +79,7 @@ impl RawModeCommand
{ {
pub fn new() -> Self { pub fn new() -> Self {
RawModeCommand { RawModeCommand {
mask: ENABLE_WRAP_AT_EOL_OUTPUT | ENABLE_LINE_INPUT
mask: ENABLE_WRAP_AT_EOL_OUTPUT | ENABLE_LINE_INPUT
} }
} }
} }
@ -100,13 +99,13 @@ impl RawModeCommand {
let new_mode = dw_mode & !self.mask; let new_mode = dw_mode & !self.mask;
// if !kernel::set_console_mode(&stdout, new_mode) { if !kernel::set_console_mode(&stdout, new_mode) {
// return Err(Error::new( return Err(Error::new(
// ErrorKind::Other, ErrorKind::Other,
// "Could not set console mode when enabling raw mode", "Could not set console mode when enabling raw mode",
// )); ));
// } }
self.disable();
Ok(()) Ok(())
} }