feat: create cargo workspace

This commit is contained in:
Valerio Ageno
2024-05-12 21:40:46 +02:00
parent 6d994a1960
commit c55fe7dde4
10 changed files with 98 additions and 0 deletions
+16
View File
@@ -8,3 +8,19 @@ pnpm-lock.yaml
examples/playground/
## Rust related ignores
# Generated by Cargo
# will have compiled files and executables
**/debug/
**/target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
**/Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
+5
View File
@@ -0,0 +1,5 @@
[workspace]
members = [
"crates/cli"
]
+15
View File
@@ -0,0 +1,15 @@
[package]
name = "tuono"
version = "0.0.1"
edition = "2021"
authors = ["V. Ageno <valerioageno@yahoo.it>"]
[lib]
name = "tuono"
path = "src/lib.rs"
[dependencies]
clap = { version = "4.5.4", features = ["derive"] }
cargo-watch = "8.5.2"
+1
View File
@@ -0,0 +1 @@
# Tuono
+12
View File
@@ -0,0 +1,12 @@
fn is_valid_project_folder(_directory: &String) -> bool {
true
}
pub fn run(directory: String) {
if !is_valid_project_folder(&directory) {
println!("It does not seem to be a valid project folder");
return;
}
todo!()
}
+3
View File
@@ -0,0 +1,3 @@
pub fn run() {
println!("Running dev environment");
}
+3
View File
@@ -0,0 +1,3 @@
pub mod build;
pub mod dev;
pub mod new;
+3
View File
@@ -0,0 +1,3 @@
pub fn run() {
println!("Scaffold new project");
}
+35
View File
@@ -0,0 +1,35 @@
use clap::{Parser, Subcommand};
pub mod actions;
#[derive(Subcommand, Debug)]
enum Actions {
/// Start the development environment
Dev,
/// Build the production assets
Build {
#[arg(short, long, default_value_t = String::from("."))]
directory: String,
},
/// Create a new project folder
New {
#[arg(short, long, default_value_t = String::from("."))]
_directory: String,
},
}
#[derive(Parser, Debug)]
#[command(version, about = "The react/rust fullstack framework")]
struct Args {
#[command(subcommand)]
action: Option<Actions>,
}
pub fn cli() {
let args = Args::parse();
match args.action.unwrap() {
Actions::Dev => actions::dev::run(),
Actions::Build { directory } => actions::build::run(directory),
Actions::New { _directory } => actions::new::run(),
}
}
+5
View File
@@ -0,0 +1,5 @@
use tuono::cli;
fn main() {
cli();
}