Skip to content

Commit

Permalink
chore: fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
BD103 committed Mar 30, 2024
2 parents 21ef72c + 56cd38e commit e031f38
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 107 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
pull_request:

jobs:
test:
name: Rust ${{matrix.rust}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
strategy:
fail-fast: false
matrix:
include:
- {rust: stable, os: ubuntu}
- {rust: stable, os: macos}
- {rust: stable, os: windows}
- {rust: beta, os: ubuntu}
- {rust: nightly, os: ubuntu}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust}}
- run: cargo check
- run: cargo check --features clippy
- run: cargo test
- run: cargo test --features clippy
- run: cargo doc
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

12 changes: 2 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ authors = ["Michael Gattozzi <[email protected]>"]
edition = "2021"
description = "A Rust flavored replacement for the classic cowsay"
documentation = "https://docs.rs/ferris-says"
homepage = "https://github.com/mgattozzi/ferris-says"
repository = "https://github.com/mgattozzi/ferris-says"
repository = "https://github.com/rust-lang/ferris-says"
readme = "README.md"
keywords = ["ferris", "cowsay", "print", "fsays", "rustacean"]
categories = [
Expand All @@ -16,14 +15,7 @@ categories = [
"command-line-utilities",
"value-formatting"
]
license = "MIT/Apache-2.0"

[badges]
travis-ci = { repository = "mgattozzi/ferris-says", branch = "master" }
appveyor = { repository = "mgattozzi/ferris-says", branch = "master", service = "github" }

[lib]
name = "ferris_says"
license = "MIT OR Apache-2.0"

[features]
clippy = []
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ ferris-says = "0.3.1"

or run:

```bash
$ cargo add ferris-says
```

Then import the crate with:

```rust
extern crate ferris_says;
```sh
cargo add ferris-says
```

### Example
Expand Down
28 changes: 0 additions & 28 deletions appveyor.yml

This file was deleted.

5 changes: 2 additions & 3 deletions fsays/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ authors = ["Michael Gattozzi <[email protected]>"]
edition = "2021"
description = "A Rust flavored replacement for the classic cowsay"
documentation = "https://docs.rs/ferris-says"
homepage = "https://github.com/mgattozzi/ferris-says"
repository = "https://github.com/mgattozzi/ferris-says"
repository = "https://github.com/rust-lang/ferris-says"
keywords = ["ferris", "cowsay", "print", "fsays", "rustacean"]
categories = [
"text-processing",
Expand All @@ -15,7 +14,7 @@ categories = [
"command-line-utilities",
"value-formatting"
]
license = "MIT/Apache-2.0"
license = "MIT OR Apache-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
49 changes: 11 additions & 38 deletions fsays/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use clap::{App, Arg};
use ferris_says::*;
use std::{
fs,
error::Error,
fs::File,
io::{stderr, stdin, stdout, BufReader, BufWriter, Read, Write},
io::{stderr, stdin, stdout, BufWriter, Read, Write},
process::exit,
str,
};
Expand Down Expand Up @@ -59,53 +59,26 @@ fn run() -> Result<(), Box<dyn Error>> {

let width = args.value_of("WIDTH").unwrap().parse().map_err(|_| ARGS)?;

let stdin = stdin();
let mut stdin = stdin();
let stdout = stdout();

let mut writer = BufWriter::new(stdout.lock());

if let Some(files) = args.values_of("FILES") {
// Read in files and say them with Ferris
let reader = files
.map(|i| {
let reader = BufReader::new(File::open(i).map_err(|_| INPUT)?);
Ok(reader.bytes().fold(
Ok(Vec::new()),
|a: Result<Vec<u8>, Box<dyn Error>>, b| {
if let Ok(mut a) = a {
a.push(b.map_err(|_| INPUT)?);
Ok(a)
} else {
a
}
},
)?)
})
.collect::<Vec<Result<Vec<u8>, Box<dyn Error>>>>();
for i in reader {
say(str::from_utf8(&i?)?, width, &mut writer).map_err(|_| STDOUT)?;
for f in files {
let content = fs::read_to_string(f).map_err(|_| INPUT)?;
say(&content, width, &mut writer).map_err(|_| STDOUT)?;
}

Ok(())
} else if let Some(other_args) = args.values_of("TEXT") {
let s = other_args.collect::<Vec<&str>>().join(" ");
say(&s, width, &mut writer).map_err(|_| STDOUT)?;

let text = other_args.collect::<Vec<&str>>().join(" ");
say(&text, width, &mut writer).map_err(|_| STDOUT)?;
Ok(())
} else {
let reader = BufReader::new(stdin.lock()).bytes().fold(
Ok(Vec::new()),
|a: Result<Vec<u8>, Box<dyn Error>>, b| {
if let Ok(mut a) = a {
a.push(b.map_err(|_| INPUT)?);
Ok(a)
} else {
a
}
},
)?;
say(str::from_utf8(&reader)?, width, &mut writer).map_err(|_| STDOUT)?;

let mut input = String::new();
stdin.read_to_string(&mut input).map_err(|_| INPUT)?;
say(&input, width, &mut writer).map_err(|_| STDOUT)?;
Ok(())
}
}

0 comments on commit e031f38

Please sign in to comment.