docstring, import, 2018 style (#211)

This commit is contained in:
Zrzka 2019-09-14 10:34:24 +02:00 committed by Timon
parent 10af72ba2a
commit 6c320b1c16
6 changed files with 23 additions and 17 deletions

View File

@ -15,4 +15,4 @@ winapi = { version = "0.3.7", features = ["wincon"] }
crossterm_winapi = { path="../crossterm_winapi", version = "0.1.5"}
[target.'cfg(unix)'.dependencies]
libc = "0.2.51"
libc = "0.2.51"

View File

@ -1,8 +1,9 @@
use std::fmt::Display;
use std::io::Write;
#[cfg(windows)]
use crate::Result;
use crate::{execute, impl_display, queue, write_cout};
use std::fmt::Display;
use std::io::Write;
/// A command is an action that can be performed on the terminal.
///

View File

@ -5,14 +5,13 @@ extern crate libc;
#[cfg(windows)]
extern crate winapi;
pub use self::command::{Command, ExecutableCommand, Output, QueueableCommand};
pub use self::error::{ErrorKind, Result};
#[cfg(windows)]
pub use self::functions::supports_ansi;
mod command;
pub mod error;
mod functions;
pub mod macros;
pub mod sys;
pub use self::command::{Command, ExecutableCommand, Output, QueueableCommand};
pub use self::error::{ErrorKind, Result};
#[cfg(windows)]
pub use self::functions::supports_ansi;

View File

@ -43,13 +43,15 @@ macro_rules! write_cout {
///
/// # Example
/// ```rust
/// use crossterm::{queue, Clear, Goto, ClearType};
///
/// use std::io::{Write, stdout};
///
/// use crossterm_utils::{queue, Output};
///
/// let mut stdout = stdout();
///
/// // will be executed when flush is called
/// queue!(stdout, Goto(5, 5), Output("5,5".to_string()));
/// queue!(stdout, Output("foo".to_string()));
///
/// // some other code (no execution happening here) ...
///
@ -121,13 +123,15 @@ macro_rules! queue {
///
/// # Example
/// ```rust
/// use crossterm::{Clear, Goto, ClearType};
/// use std::io::Write;
///
/// use crossterm_utils::{execute, Output};
///
/// // will be executed directly
/// execute!(std::io::stdout(), Goto(5, 5));
/// execute!(std::io::stdout(), Output("foo".to_string()));
///
/// // will be executed directly
/// execute!(std::io::stdout(), Goto(10, 10), Clear(ClearType::CurrentLine));
/// execute!(std::io::stdout(), Output("foo".to_string()), Output("bar".to_string()));
/// ```
///
/// # Remarks

View File

@ -1,9 +1,9 @@
//! This module contains all `unix` specific terminal related logic.
pub use libc::{c_int, termios as Termios};
use std::{io, mem};
pub use libc::{c_int, termios as Termios};
static mut ORIGINAL_TERMINAL_MODE: Option<Termios> = None;
pub static mut RAW_MODE_ENABLED: bool = false;

View File

@ -1,8 +1,10 @@
pub mod ansi {
use crossterm_winapi::ConsoleMode;
use std::io;
use winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING;
use crossterm_winapi::ConsoleMode;
/// Toggle virtual terminal processing.
///
/// This method attempts to toggle virtual terminal processing for this