Skip to content

Commit

Permalink
Rename Output to Print
Browse files Browse the repository at this point in the history
When trying to use both `std::process::Output` and `bullet_stream::Output` in the same file there is an import collision.

With this change the `Print`  struct is introduced. The `Output` struct is still available but is deprecated.

Close #4
  • Loading branch information
schneems committed Jun 6, 2024
1 parent 345d159 commit 528d786
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 79 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

## v0.2.0 - 2024/06/06

- Added: `Print` struct. `Output` is now deprecated, use `Print` instead (https://github.com/schneems/bullet_stream/pull/5)
- Fix: Missing `must_use` attributes (https://github.com/schneems/bullet_stream/pull/5)

## v0.1.1 - 2024/06/03

- Fix double newlines for headers (https://github.com/schneems/bullet_stream/pull/2)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bullet_stream"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
license = "MIT"
description = "Bulletproof printing for bullet point text"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Add bullet_stream to your project:
$ cargo add bullet_stream
```

Now use [`Output`] to output structured text as a script/buildpack executes. The output
Now use [`Print`] to output structured text as a script/buildpack executes. The output
is intended to be read by the end user.

```rust
use bullet_stream::Output;
use bullet_stream::Print;

let mut output = Output::new(std::io::stdout())
let mut output = Print::new(std::io::stdout())
.h2("Example Buildpack")
.warning("No Gemfile.lock found");

Expand Down
9 changes: 4 additions & 5 deletions examples/style_guide.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// use commons::output::fmt::{self, DEBUG_INFO, HELP};
use ascii_table::AsciiTable;
#[allow(clippy::wildcard_imports)]
use bullet_stream::{style, Output};
use bullet_stream::{style, Print};
use fun_run::CommandWithName;
use indoc::formatdoc;
use std::io::stdout;
Expand All @@ -10,7 +9,7 @@ use std::process::Command;
#[allow(clippy::too_many_lines)]
fn main() {
{
let mut log = Output::new(stdout()).h1("Living build output style guide");
let mut log = Print::new(stdout()).h1("Living build output style guide");
log = log.h2("Bullet section features");
log = log
.bullet("Bullet example")
Expand Down Expand Up @@ -66,7 +65,7 @@ fn main() {
#[allow(clippy::unwrap_used)]
let cmd_error = Command::new("iDoNotExist").named_output().err().unwrap();

let mut log = Output::new(stdout()).h2("Error and warnings");
let mut log = Print::new(stdout()).h2("Error and warnings");
log = log
.bullet("Debug information")
.sub_bullet("Should go above errors in section/step format")
Expand Down Expand Up @@ -106,7 +105,7 @@ fn main() {
}

{
let log = Output::new(stdout()).h2("Formatting helpers");
let log = Print::new(stdout()).h2("Formatting helpers");
log.bullet("The fmt module")
.sub_bullet(formatdoc! {"
Formatting helpers can be used to enhance log output:
Expand Down
Loading

0 comments on commit 528d786

Please sign in to comment.