use clap::{Args, Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(
name = "gize",
version,
about = "Productivity-first backend framework for Rust"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Args, Clone, Copy, Default)]
pub struct GenFlags {
#[arg(long, global = true)]
pub force: bool,
#[arg(long, global = true)]
pub dry_run: bool,
}
#[derive(Debug, Subcommand)]
pub enum Command {
New {
name: String,
#[arg(long)]
no_user: bool,
#[command(flatten)]
flags: GenFlags,
},
#[command(subcommand)]
Make(MakeCommand),
Migrate {
#[arg(long)]
status: bool,
},
Serve,
Sync {
#[command(flatten)]
flags: GenFlags,
},
Doctor,
Fmt,
Check,
}
#[derive(Debug, Subcommand)]
pub enum MakeCommand {
App {
name: String,
#[command(flatten)]
flags: GenFlags,
},
Model {
name: String,
fields: Vec<String>,
#[command(flatten)]
flags: GenFlags,
},
Crud {
name: String,
fields: Vec<String>,
#[command(flatten)]
flags: GenFlags,
},
Migration {
name: Option<String>,
#[command(flatten)]
flags: GenFlags,
},
Admin {
name: String,
#[command(flatten)]
flags: GenFlags,
},
}