✨➖📝 cli, vanth, meta, flake: Simplify dependencies, add meta crate, and improve docs
- Removed dependencies `sqlx` and `bevy_app` to simplify the project. - Added new crate `vanth_meta` for generating example SVGs. - Updated CLI tests to use `assert_cmd` for better test assertions. - Enhanced README with comprehensive library and CLI usage documentation. - Modified `Store::write` in `vanth` crate to return the content hash. - Set `checkPhase` to empty in Nix flake configuration.
This commit is contained in:
parent
1001819e4c
commit
ff57ee8deb
13 changed files with 426 additions and 1158 deletions
|
@ -1,6 +1,6 @@
|
|||
use assert_cmd::Command;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
|
@ -8,33 +8,14 @@ use tempfile::tempdir;
|
|||
use vanth::{ContentHash, Vanth, hash as vanth_hash};
|
||||
|
||||
fn run_vanth(args: &[&str], input: Option<&str>) -> (String, String, i32) {
|
||||
let mut cmd = Command::new(env!("CARGO_BIN_EXE_vanth_cli"));
|
||||
cmd.args(args);
|
||||
if let Some(inp) = input {
|
||||
let mut child = cmd
|
||||
.stdin(std::process::Stdio::piped())
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.stderr(std::process::Stdio::piped())
|
||||
.spawn()
|
||||
.unwrap();
|
||||
{
|
||||
let stdin = child.stdin.as_mut().unwrap();
|
||||
stdin.write_all(inp.as_bytes()).unwrap();
|
||||
}
|
||||
let output = child.wait_with_output().unwrap();
|
||||
(
|
||||
String::from_utf8(output.stdout).unwrap(),
|
||||
String::from_utf8(output.stderr).unwrap(),
|
||||
output.status.code().unwrap(),
|
||||
)
|
||||
} else {
|
||||
let output = cmd.output().unwrap();
|
||||
(
|
||||
String::from_utf8(output.stdout).unwrap(),
|
||||
String::from_utf8(output.stderr).unwrap(),
|
||||
output.status.code().unwrap(),
|
||||
)
|
||||
}
|
||||
let mut cmd = Command::cargo_bin("vanth").unwrap();
|
||||
let output = cmd.args(args).write_stdin(input.unwrap_or("")).output().unwrap();
|
||||
|
||||
(
|
||||
String::from_utf8(output.stdout).unwrap(),
|
||||
String::from_utf8(output.stderr).unwrap(),
|
||||
output.status.code().unwrap(),
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, Vanth)]
|
||||
|
@ -72,7 +53,7 @@ fn test_write_get() {
|
|||
panic!("{}", stderr);
|
||||
}
|
||||
let hash = stdout.trim();
|
||||
println!("x{}x", hash);
|
||||
println!("{}", hash);
|
||||
|
||||
let (stdout, stderr, exit) = run_vanth(&["get", "--db", &db_path, "--ty", &Foo::ty().to_string(), &hash], None);
|
||||
if exit != 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue