Skip to content

Commit

Permalink
Merge pull request #23 from Sellig6792/develop
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
Sellig6792 authored Jan 28, 2023
2 parents ce88823 + 5202df1 commit 986bd08
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 79 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
args: -- --check --color=always

clippy_check:
name: Clippy Check
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --color=always
args: --all-features --release --color=always


package:
Expand All @@ -93,7 +93,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: package
args: --color=always
args: --all-features --color=always

publish:
name: Publish
Expand All @@ -108,4 +108,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CRATES_IO_TOKEN }} --color=always
args: --all-features --token ${{ secrets.CRATES_IO_TOKEN }} --color=always
139 changes: 67 additions & 72 deletions .github/workflows/pull-request-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,70 @@ on:
- main

jobs:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --color=always

format_check:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

clippy_check:
name: Clippy Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --color=always -- -D warnings

check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --color=always

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --color=always
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --color=always
format_check:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check --color=always
clippy_check:
name: Clippy Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --color=always -- -D warnings
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --color=always
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --all-features --release --color=always
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cprint"
description = "Cargo-like print"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
authors = ["Sellig6792 <[email protected]>"]
homepage = "https://github.com/Sellig6792/cprint"
Expand All @@ -14,6 +14,11 @@ license = "MIT"
name = "cprint"
path = "src/lib.rs"

[features]
default = ["cprint"]
coloration = []
cprint = ["coloration"]
ceprint = ["coloration"]

[dependencies]
colored = "2.0.0"
26 changes: 26 additions & 0 deletions src/ceprint_macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// Print an error like Cargo does. The argument is the message of the error.
/// The end of the title is padded with spaces to make it 12 characters long.
/// # Examples
/// ```rust
/// use cprint::{ceprint, Color, Coloration};
///
/// ceprint!("Failed to compile");
/// ```
#[macro_export]
macro_rules! ceprint {
($msg:expr) => {
print!(
"{} {}",
format!("{}{}", " ".repeat(12 - "Error".len()), "Error").apply_color(Color::Red),
$msg
);
};
}

/// Same as [`ceprint!`] but with a newline at the end.
#[macro_export]
macro_rules! ceprintln {
($title:expr, $msg:expr) => {
ceprintln!($title, $msg, Color::Red);
};
}
File renamed without changes.
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
//! cprint!("Using", "cprint crate!", Color::Green);
//! ```

mod color;
#[cfg(feature = "coloration")]
mod coloration;

#[cfg(feature = "coloration")]
pub use coloration::{Color, Coloration};

#[cfg(feature = "cprint")]
mod cprint_macros;

pub use color::{Color, Coloration};
#[cfg(feature = "ceprint")]
mod ceprint_macros;

0 comments on commit 986bd08

Please sign in to comment.