namespace reformat, 2018 style, warnings (#210)
This commit is contained in:
parent
fa4654ac80
commit
2d4c1eec4d
@ -1,8 +1,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Terminal Examples
|
//! Terminal Examples
|
||||||
//!
|
//!
|
||||||
extern crate crossterm_cursor;
|
#![allow(unused_must_use)]
|
||||||
extern crate crossterm_terminal;
|
|
||||||
|
|
||||||
use crossterm_cursor::cursor;
|
use crossterm_cursor::cursor;
|
||||||
use crossterm_terminal::{terminal, ClearType};
|
use crossterm_terminal::{terminal, ClearType};
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
#[macro_use]
|
|
||||||
extern crate crossterm_utils;
|
|
||||||
extern crate crossterm_cursor;
|
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
extern crate crossterm_winapi;
|
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
extern crate libc;
|
|
||||||
|
|
||||||
mod sys;
|
mod sys;
|
||||||
mod terminal;
|
mod terminal;
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
#[cfg(unix)]
|
||||||
|
pub use self::unix::{exit, get_terminal_size};
|
||||||
|
#[cfg(windows)]
|
||||||
|
pub use self::winapi::{exit, get_terminal_size};
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub mod winapi;
|
pub mod winapi;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub mod unix;
|
pub mod unix;
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
pub use self::unix::{exit, get_terminal_size};
|
|
||||||
#[cfg(windows)]
|
|
||||||
pub use self::winapi::{exit, get_terminal_size};
|
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
//! This is an `ANSI escape code` specific implementation for terminal related action.
|
//! This is an `ANSI escape code` specific implementation for terminal related action.
|
||||||
//! This module is used for windows 10 terminals and unix terminals by default.
|
//! This module is used for windows 10 terminals and unix terminals by default.
|
||||||
|
|
||||||
use super::ITerminal;
|
|
||||||
use crate::{sys::get_terminal_size, ClearType};
|
|
||||||
use crossterm_cursor::TerminalCursor;
|
|
||||||
use crossterm_utils::Result;
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
|
use crossterm_cursor::TerminalCursor;
|
||||||
|
use crossterm_utils::{csi, write_cout, Result};
|
||||||
|
|
||||||
|
use crate::{sys::get_terminal_size, ClearType};
|
||||||
|
|
||||||
|
use super::ITerminal;
|
||||||
|
|
||||||
pub static CLEAR_ALL: &'static str = csi!("2J");
|
pub static CLEAR_ALL: &'static str = csi!("2J");
|
||||||
pub static CLEAR_FROM_CURSOR_DOWN: &'static str = csi!("J");
|
pub static CLEAR_FROM_CURSOR_DOWN: &'static str = csi!("J");
|
||||||
pub static CLEAR_FROM_CURSOR_UP: &'static str = csi!("1J");
|
pub static CLEAR_FROM_CURSOR_UP: &'static str = csi!("1J");
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
//! A module that contains all the actions related to the terminal. like clearing, resizing, pausing and scrolling the terminal.
|
//! A module that contains all the actions related to the terminal. like clearing, resizing, pausing and scrolling the terminal.
|
||||||
|
#[cfg(feature = "serde")]
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crossterm_utils::Result;
|
||||||
|
|
||||||
|
use self::ansi_terminal::AnsiTerminal;
|
||||||
|
pub use self::terminal::{terminal, Clear, ScrollDown, ScrollUp, SetSize, Terminal};
|
||||||
|
#[cfg(windows)]
|
||||||
|
use self::winapi_terminal::WinApiTerminal;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test;
|
mod test;
|
||||||
|
|
||||||
@ -8,17 +18,6 @@ mod ansi_terminal;
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
mod winapi_terminal;
|
mod winapi_terminal;
|
||||||
|
|
||||||
use self::ansi_terminal::AnsiTerminal;
|
|
||||||
#[cfg(windows)]
|
|
||||||
use self::winapi_terminal::WinApiTerminal;
|
|
||||||
|
|
||||||
pub use self::terminal::{terminal, Clear, ScrollDown, ScrollUp, SetSize, Terminal};
|
|
||||||
|
|
||||||
use crossterm_utils::Result;
|
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// Enum with the different values to clear the terminal.
|
/// Enum with the different values to clear the terminal.
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)]
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
//! A module that contains all the actions related to the terminal.
|
//! A module that contains all the actions related to the terminal.
|
||||||
//! Like clearing and scrolling in the terminal or getting the window size from the terminal.
|
//! Like clearing and scrolling in the terminal or getting the window size from the terminal.
|
||||||
|
|
||||||
use super::{AnsiTerminal, ClearType, ITerminal};
|
use std::fmt;
|
||||||
use crossterm_utils::{Command, Result};
|
use std::io::Write;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
use crossterm_utils::supports_ansi;
|
||||||
|
use crossterm_utils::{impl_display, write_cout, Command, Result};
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use super::WinApiTerminal;
|
use super::WinApiTerminal;
|
||||||
#[cfg(windows)]
|
use super::{AnsiTerminal, ClearType, ITerminal};
|
||||||
use crossterm_utils::supports_ansi;
|
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
use std::io::Write;
|
|
||||||
|
|
||||||
/// Allows you to preform actions on the terminal.
|
/// Allows you to preform actions on the terminal.
|
||||||
///
|
///
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
//!
|
//!
|
||||||
//! Windows versions lower then windows 10 are not supporting ANSI codes. Those versions will use this implementation instead.
|
//! Windows versions lower then windows 10 are not supporting ANSI codes. Those versions will use this implementation instead.
|
||||||
|
|
||||||
use super::*;
|
|
||||||
use crate::sys::winapi::get_terminal_size;
|
|
||||||
use crossterm_cursor::sys::winapi::Cursor;
|
use crossterm_cursor::sys::winapi::Cursor;
|
||||||
use crossterm_utils::{ErrorKind, Result};
|
use crossterm_utils::{ErrorKind, Result};
|
||||||
use crossterm_winapi::{Console, Coord, Handle, ScreenBuffer, Size};
|
use crossterm_winapi::{Console, Coord, Handle, ScreenBuffer, Size};
|
||||||
|
|
||||||
|
use crate::sys::winapi::get_terminal_size;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
/// This struct is a winapi implementation for terminal related actions.
|
/// This struct is a winapi implementation for terminal related actions.
|
||||||
pub struct WinApiTerminal;
|
pub struct WinApiTerminal;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user