Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
hwittenborn authored Jul 3, 2023
2 parents ea43692 + e886538 commit 044a58d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 45 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish
on:
push:
branches: [master]
permissions:
contents: write

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get local crate version
id: local-version
run: cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version' | echo "VERSION=$(cat)" >> "${GITHUB_OUTPUT}"
- name: Get crates.io crate version
id: remote-version
run: curl 'https://index.crates.io/co/lo/colored' | jq -r '.vers' | tail -n 1 | echo "VERSION=$(cat)" >> "${GITHUB_OUTPUT}"
- name: Check if crates.io version is older than local version
id: needs-update
run: |
if ! printf '%s\n' "${{ steps.local-version.outputs.VERSION }}" "${{ steps.remote-version.outputs.VERSION }}" | sort -V | tail -n 1 | grep -Fw "${{ steps.remote-version.outputs.VERSION }}"; then
echo "UPDATE=true" >> "${GITHUB_OUTPUT}"
else
echo "UPDATE=false" >> "${GITHUB_OUTPUT}"
fi
- name: Install parse-changelog
if: steps.needs-update.outputs.UPDATE == 'true'
uses: taiki-e/install-action@parse-changelog
- name: Create GitHub release
if: steps.needs-update.outputs.UPDATE == 'true'
run: gh release create "v${{ steps.local-version.outputs.VERSION }}" -t "v${{ steps.local-version.outputs.VERSION }}" -n "$(parse-changelog CHANGELOG.md "${{ steps.local-version.outputs.VERSION }}")"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Publish to crates.io
if: steps.needs-update.outputs.UPDATE == 'true'
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: "${{ secrets.CARGO_REGISTRY_TOKEN }}"
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Run tests
on: pull_request
env: { CLICOLOR_FORCE: 1 }

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run formatting checks
run: cargo fmt --check
- name: Run clippy checks
run: cargo clippy --all-features -- -D warnings
- name: Run tests
run: cargo test
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2.0.1 (July 3, 2023)
- Add edition for future compatibility.
- Implement custom colors that can be stored in a variable.

# 2.0.0 (July 14, 2020)
- Add support for true colours.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "colored"
description = "The most simple way to add colors in your terminal"
version = "2.0.0"
version = "2.0.1"
edition = "2021"
authors = ["Thomas Wickham <mackwic@gmail.com>"]
license = "MPL-2.0"
Expand Down
23 changes: 2 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Colored

[![Build
Status](https://travis-ci.org/mackwic/colored.svg?branch=master)](https://travis-ci.org/mackwic/colored) [![Crates.io](https://img.shields.io/crates/v/colored.svg?maxAge=2592000)](https://crates.io/crates/colored) [![Crates.io](https://img.shields.io/crates/l/colored.svg?maxAge=2592000)](https://github.com/mackwic/colored/blob/master/LICENSE)
[![Crates.io](https://img.shields.io/crates/v/colored.svg?maxAge=2592000)](https://crates.io/crates/colored) [![Crates.io](https://img.shields.io/crates/l/colored.svg?maxAge=2592000)](https://github.com/mackwic/colored/blob/master/LICENSE)

Coloring terminal so simple, you already know how to do it!

Expand Down Expand Up @@ -127,25 +126,6 @@ dumb_terminal = ["colored/no-color"]
You can use have even finer control by using the
`colored::control::set_override` method.

## Build with Docker

### Install Docker

Use the install instructions located [here](https://docs.docker.com/v17.12/install/)

### Build the Docker image

```docker build -t colored_image .```

### Build the library

```docker run --rm -it -v "$PWD":/src -u `id -u`:`id -g` colored_image /bin/bash -c "cargo build"```

### Test the library

```docker run --rm -it -v "$PWD":/src -u `id -u`:`id -g` colored_image /bin/bash -c "cargo test"```


## Todo

- **More tests ?**: We always welcome more tests! Please contribute!
Expand Down Expand Up @@ -175,6 +155,7 @@ In non legal terms it means that:
## Contributors

- Thomas Wickham: [@mackwic](https://github.com/mackwic)
- Hunter Wittenborn [@hwittenborn](https://github.com/hwittenborn)
- Corey "See More" Richardson: [@cmr](https://github.com/cmr)
- Iban Eguia: [@Razican](https://github.com/Razican)
- Alexis "Horgix" Chotard: [@horgix](https://github.com/horgix)
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,8 @@ pub trait Colorize {
fn italic(self) -> ColoredString;
fn underline(self) -> ColoredString;
fn blink(self) -> ColoredString;
/// Historical name of `Colorize::reversed`. May be removed in a future version. Please use
/// `Colorize::reversed` instead
#[deprecated(since = "1.5.2", note = "Users should use reversed instead")]
fn reverse(self) -> ColoredString;
/// This should be preferred to `Colorize::reverse`.
fn reversed(self) -> ColoredString;
fn hidden(self) -> ColoredString;
fn strikethrough(self) -> ColoredString;
Expand Down
2 changes: 1 addition & 1 deletion src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Styles {

let res: Vec<Styles> = STYLES
.iter()
.filter(|&&(ref mask, _)| (0 != (u & mask)))
.filter(|&(mask, _)| (0 != (u & mask)))
.map(|&(_, value)| value)
.collect();
if res.is_empty() {
Expand Down

0 comments on commit 044a58d

Please sign in to comment.