✨➕♻️💩 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:
parent
45a68865b6
commit
8b76fcb659
10 changed files with 218 additions and 15 deletions
47
crates/cli/src/cli.rs
Normal file
47
crates/cli/src/cli.rs
Normal 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);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue