Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Refactors #2

Merged
merged 21 commits into from
Sep 30, 2019
Merged
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Build only pushed (merged) master or any pull request. This avoids the
# pull request to be build twice.
branches:
only:
- master

language: rust

rust:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Version master

- Added unit tests
TimonPost marked this conversation as resolved.
Show resolved Hide resolved
- Restructured files
- Removed unsafe static code
- Improved documentation and added book page to lib.rs
- Fixed bug with `SetBg` command, WinApi logic
- Fixed bug with `StyledObject`, used stdout for resetting terminal color
- Introduced `ResetColor` command

# Version 0.5.1

- Maintenance release only
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ edition = "2018"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.8", features = ["wincon"] }
crossterm_winapi = { version = "0.2.1" }
lazy_static = "1.4"

[dependencies]
crossterm_utils = { version = "0.3.1" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ crossterm_style = "0.5"
And import the `crossterm_style` modules you want to use.

```rust
pub use crossterm_style::{color, style, Attribute, Color, ColorType, ObjectStyle, StyledObject, TerminalColor, Colorize, Styler};
pub use crossterm_style::{color, style, Attribute, Color, ObjectStyle, StyledObject, TerminalColor, Colorize, Styler};
```

### Useful Links
Expand Down
106 changes: 0 additions & 106 deletions src/ansi_color.rs

This file was deleted.

166 changes: 0 additions & 166 deletions src/color.rs

This file was deleted.

18 changes: 10 additions & 8 deletions src/enums/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt::Display;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use crossterm_utils::csi;
use crate::SetAttr;

/// Enum with the different attributes to style your test.
///
Expand All @@ -17,7 +17,9 @@ use crossterm_utils::csi;
/// # Example
/// You can use an attribute in a write statement to apply the attribute to the terminal output.
///
/// ```ignore
/// ```no_run
/// use crossterm_style::Attribute;
///
/// println!(
/// "{} Underlined {} No Underline",
/// Attribute::Underlined,
Expand All @@ -26,12 +28,12 @@ use crossterm_utils::csi;
/// ```
///
/// You can also call attribute functions on a `&'static str`:
/// ```ignore
/// use Colorizer;
/// ```no_run
/// use crossterm_style::Styler;
///
/// println!("{}", style("Bold text").bold());
/// println!("{}", style("Underlined text").underlined());
/// println!("{}", style("Negative text").negative());
/// println!("{}", "Bold text".bold());
/// println!("{}", "Underlined text".underlined());
/// println!("{}", "Negative text".negative());
/// ```
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)]
Expand Down Expand Up @@ -142,7 +144,7 @@ pub enum Attribute {

impl Display for Attribute {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
write!(f, "{}", format!(csi!("{}m"), *self as i16))?;
write!(f, "{}", SetAttr(*self))?;
Ok(())
}
}
Loading