Skip to content

Commit

Permalink
add pattern explanation to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadlock0133 committed Dec 29, 2022
1 parent d1c4d60 commit a54d87b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,21 @@ cargo install cargo-vibe
```shell
cargo vibe build
```

# Configuration

By default, `cargo-vibe` will, on success, vibe full strength for 3 seconds.

You can change that by setting `CARGO_VIBE_PATTERN` environment variable. For
example, to set it vibe for 1.5 second on 20% strength, you can do:

```shell
CARGO_VIBE_PATTERN="0.2 1.5s" cargo vibe <cmd>
```

You can also set full patterns of vibes to run, by separating them with slashes
`/`. Here is one example:

```
CARGO_VIBE_PATTERN="0.4 1s/0.6 1s/0.8 0.75s/1.0 0.25s"
```
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ fn parse_pattern(
.split('/')
.map(|x| {
let (speed, duration) =
x.split_once(" ").ok_or("couldn't split")?;
x.split_once(' ').ok_or("couldn't split")?;
let speed = speed.parse()?;
let duration = duration
.strip_suffix("s")
.strip_suffix('s')
.ok_or("missing 's'")?
.parse()
.map(Duration::from_secs_f64)?;
Expand Down

0 comments on commit a54d87b

Please sign in to comment.