diff --git a/readme.md b/readme.md index 4a6c25d..6d8fcb5 100644 --- a/readme.md +++ b/readme.md @@ -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 +``` + +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" +``` diff --git a/src/main.rs b/src/main.rs index cbdeeef..9931b9b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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)?;