Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: BurntSushi/termcolor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.3.0
Choose a base ref
...
head repository: BurntSushi/termcolor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.4.0
Choose a head ref
  • 5 commits
  • 4 files changed
  • 2 contributors

Commits on Sep 19, 2023

  1. doc: various polish

    Instead of changing the version in the README for every release, we just
    note to run `cargo add termcolor`, which will pull in the latest version
    automatically.
    
    We also remove the recommendation to use `atty`, which is in line with
    the changes we made to the crate documentation.
    
    Closes #77
    atouchet authored and BurntSushi committed Sep 19, 2023
    Copy the full SHA
    24cd436 View commit details
  2. doc: a few more touchups

    PR #78
    atouchet authored Sep 19, 2023
    Copy the full SHA
    ba07e15 View commit details

Commits on Sep 21, 2023

  1. ci: bump MSRV to Rust 1.60

    winapi-util has bumped its MSRV, but termcolor still works fine with
    winapi-util <0.1.6.
    
    (I didn't bother figuring out winapi-util's actual MSRV, but it does at
    least build with Rust 1.60. So it's unlikely to be a problem in
    practice.)
    
    <... after a few rounds of CI failures ...>
    
    OK, for some reason, I can't successfully pin winapi-util to 0.1.5
    locally or in CI. It is senseless to burn more time on it, so let's just
    set the pinned version to Rust 1.60 and be done with it.
    BurntSushi committed Sep 21, 2023
    Copy the full SHA
    dbe5733 View commit details

Commits on Nov 14, 2023

  1. api: add Clone impls

    There's no reason not to have these. I suspect I didn't add them
    originally because types like `std::io::Stdout` don't implement `Clone`.
    And so, the structures that contain them can't either. But that's not
    true of all `std::io::Write` implementations.
    BurntSushi committed Nov 14, 2023
    Copy the full SHA
    da784a9 View commit details
  2. 1.4.0

    BurntSushi committed Nov 14, 2023
    Copy the full SHA
    e5f7a6c View commit details
Showing with 16 additions and 30 deletions.
  1. +2 −11 .github/workflows/ci.yml
  2. +1 −1 Cargo.toml
  3. +9 −14 README.md
  4. +4 −4 src/lib.rs
13 changes: 2 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -12,22 +12,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- pinned
- pinned-win
- stable
- beta
- nightly
- macos
- win-msvc
- win-gnu
include:
- build: pinned
os: ubuntu-latest
rust: 1.34.0
rust: 1.60.0
- build: pinned-win
os: windows-latest
rust: 1.34.0
rust: 1.60.0
- build: stable
os: ubuntu-latest
rust: stable
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "termcolor"
version = "1.3.0" #:version
version = "1.4.0" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = """
A simple cross platform library for writing colored text to a terminal.
23 changes: 9 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
termcolor
=========
A simple cross platform library for writing colored text to a terminal. This
library writes colored text either using standard ANSI escape sequences or
by interacting with the Windows console. Several convenient abstractions
are provided for use in single-threaded or multi-threaded command line
library writes colored text either using standard ANSI escape sequences or by
interacting with the Windows console. Several convenient abstractions are
provided for use in single-threaded or multi-threaded command line
applications.

[![Build status](https://github.com/BurntSushi/termcolor/workflows/ci/badge.svg)](https://github.com/BurntSushi/termcolor/actions)
[![](https://img.shields.io/crates/v/termcolor.svg)](https://crates.io/crates/termcolor)
[![crates.io](https://img.shields.io/crates/v/termcolor.svg)](https://crates.io/crates/termcolor)

Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).

@@ -17,12 +17,7 @@ Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).

### Usage

Add this to your `Cargo.toml`:

```toml
[dependencies]
termcolor = "1.2"
```
Run `cargo add termcolor` to add this dependency to your `Cargo.toml` file.

### Organization

@@ -47,8 +42,8 @@ analogous type for the Windows console is not provided since it cannot exist.
### Example: using `StandardStream`

The `StandardStream` type in this crate works similarly to `std::io::Stdout`,
except it is augmented with methods for coloring by the `WriteColor` trait.
For example, to write some green text:
except it is augmented with methods for coloring by the `WriteColor` trait. For
example, to write some green text:

```rust
use std::io::{self, Write};
@@ -98,8 +93,8 @@ termcolor will inspect the `TERM` and `NO_COLOR` environment variables:
This decision procedure may change over time.

Currently, `termcolor` does not attempt to detect whether a tty is present or
not. To achieve that, please use the [`atty`](https://crates.io/crates/atty)
crate.
not. To achieve that, please use
[`std::io::IsTerminal`](https://doc.rust-lang.org/std/io/trait.IsTerminal.html).

### Minimum Rust version policy

8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1179,11 +1179,11 @@ impl BufferWriter {
/// method, which will take color preferences and the environment into
/// account. However, buffers can also be manually created using `no_color`,
/// `ansi` or `console` (on Windows).
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Buffer(BufferInner);

/// BufferInner is an enumeration of different buffer types.
#[derive(Debug)]
#[derive(Clone, Debug)]
enum BufferInner {
/// No coloring information should be applied. This ignores all coloring
/// directives.
@@ -1383,7 +1383,7 @@ impl WriteColor for Buffer {
}

/// Satisfies `WriteColor` but ignores all color options.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct NoColor<W>(W);

impl<W: Write> NoColor<W> {
@@ -1454,7 +1454,7 @@ impl<W: io::Write> WriteColor for NoColor<W> {
}

/// Satisfies `WriteColor` using standard ANSI escape sequences.
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct Ansi<W>(W);

impl<W: Write> Ansi<W> {