Add readme

This commit is contained in:
Ivan Bushchik 2023-03-19 17:59:56 +03:00
parent a260f7a4c9
commit 18d6c99fb5
No known key found for this signature in database
GPG key ID: 9F6DDABE11A2674D
2 changed files with 47 additions and 1 deletions

45
README.md Normal file
View file

@ -0,0 +1,45 @@
# cargo-makima
Makima's here to abuse you when running cargo~
Fork of cargo-mommy
# Installation
Install cargo-makima like you would any other cargo extension~
```text
> cargo install cargo-makima
```
# Usage
Run whatever cargo command you would normally but add makima after cargo~
```text
> cargo makima test
Finished test [unoptimized + debuginfo] target(s) in 0.00s
Running unittests src\main.rs (target\debug\deps\cargo_makima-3804b5c850d46137.exe)
running 1 test
test test ... FAILED
failures:
---- test stdout ----
thread 'test' panicked at 'oops!!', src\main.rs:26:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
test
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
error: test failed, to rerun pass `--bin cargo-makima`
What could I do to absolutely deny you of a normal life?
>_
```

View file

@ -28,6 +28,7 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_owned()); let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_owned());
let mut arg_iter = std::env::args(); let mut arg_iter = std::env::args();
let _cargo = arg_iter.next(); let _cargo = arg_iter.next();
let _makima = arg_iter.next();
let mut cmd = std::process::Command::new(cargo); let mut cmd = std::process::Command::new(cargo);
cmd.args(arg_iter); cmd.args(arg_iter);
@ -45,7 +46,7 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
fn select_response(response_type: ResponseType) -> String { fn select_response(response_type: ResponseType) -> String {
let mut rng = StdRng::from_entropy(); let mut rng = StdRng::from_entropy();
// Choose what mommy will say~ // Choose what makima will say~
let responses: Responses = serde_json::from_str(RESPONSES).expect("RESPONSES to be valid JSON"); let responses: Responses = serde_json::from_str(RESPONSES).expect("RESPONSES to be valid JSON");
let response = match response_type { let response = match response_type {