♻️💩 cli, vanth, Cargo.toml, Cargo.lock: Add CLI framework and refactor vanth crate structure

- Added a new `vanth_cli` crate with `clap` command structure for `vanth fs open/save` commands.
- Removed `main.rs` from `vanth` crate as it is now a library without a binary target.
- Added `fs.rs` module and new structs `HashedValue`, `Value`, `Ty` with `Vanth` trait to support serialization.
- Updated `Cargo.toml` to include `clap` as a workspace dependency and added `vanth_cli` as a new crate.
- Added multiple dependencies (`anstream`, `anstyle`, `clap`, `heck`, etc.) in `Cargo.lock` to support the CLI.
- Created placeholder test files `tests/fs/mod.rs` and `tests/main.rs` in `vanth` crate for future use.
- Marked CLI command implementations with TODOs as functionality is not yet implemented.
This commit is contained in:
Markus Scully 2025-08-04 21:36:25 +03:00
parent 45a68865b6
commit 8b76fcb659
Signed by: mascully
GPG key ID: 93CA5814B698101C
10 changed files with 218 additions and 15 deletions

8
crates/cli/Cargo.toml Normal file
View file

@ -0,0 +1,8 @@
[package]
name = "vanth_cli"
version.workspace = true
edition.workspace = true
[dependencies]
clap.workspace = true
vanth = { path = "../vanth" }

47
crates/cli/src/cli.rs Normal file
View file

@ -0,0 +1,47 @@
use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(name = "vanth")]
#[command(about = "Vanth CLI tool")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
#[command(about = "File system operations")]
Fs {
#[command(subcommand)]
command: FsCommands,
},
}
#[derive(Subcommand, Debug)]
pub enum FsCommands {
#[command(about = "Read from path and print JSON to stdout")]
Open {
#[arg(help = "Path to read from")]
path: String,
},
#[command(about = "Take JSON from stdin and write to path")]
Save {
#[arg(help = "Path to write to")]
path: String,
},
}
pub fn execute(cli: Cli) {
match cli.command {
Commands::Fs { command } => match command {
FsCommands::Open { path } => {
// TODO: implement fs open functionality
println!("fs open: {}", path);
}
FsCommands::Save { path } => {
// TODO: implement fs save functionality
println!("fs save: {}", path);
}
},
}
}

10
crates/cli/src/main.rs Normal file
View file

@ -0,0 +1,10 @@
use clap::Parser;
mod cli;
use cli::Cli;
fn main() {
let cli = Cli::parse();
cli::execute(cli);
}