1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
use clap::{Args, Parser, Subcommand};
#[derive(Debug, Parser)]
#[clap(author, version, about)]
pub struct ClapperArgs {
#[clap(subcommand)]
pub entity_type: EntityType,
}
// ---------------
// Valid Commands: get | scaffold
// ---------------
#[derive(Debug, Subcommand)]
pub enum EntityType {
/// Clones projects boilerplate for diamond standard (JavaScript, TypeScript and Foundry) and NestJs
Get(GetCommand),
/// Scaffolds projects for any development tool
Scaffold(ScaffoldCommand),
/// Installs dependencies and software development tools
Install(InstallCommand),
}
// ----------------
// GetCommand Args
// ----------------
#[derive(Debug, Args)]
pub struct GetCommand{
#[clap(subcommand)]
pub command: GetSubCommand,
}
#[derive(Debug, Subcommand)]
pub enum GetSubCommand {
/// Clones a diamond standard JavaScript project
Dhjs(GetDir),
/// Clones a diamond standard TypeScript project
Dhts(GetDir),
/// Clones a diamond standard Foundry project
Dfd(GetDir),
/// Clones a NestJS project boilerplate
Nestjs(GetDir)
}
// --------------------
// ScaffoldCommand Args
// --------------------
#[derive(Debug, Args)]
pub struct ScaffoldCommand{
#[clap(subcommand)]
pub command: ScaffoldSubCommand,
}
#[derive(Debug, Subcommand)]
pub enum ScaffoldSubCommand {
/// Scaffolds a create-react-app JavaScript project
Reactjs(GetDir),
/// Scaffolds a create-react-app TypeScript project
Reactts(GetDir),
/// Scaffolds a Hardhat project
Hardhat(GetDir),
/// Scaffolds a NestJS project
Nestjs(GetDir),
/// Scaffolds a Laravel project
Laravel(GetDir),
/// Scaffolds a Next project
Nextjs(GetDir),
/// Scaffolds a Foundry project
Foundry(GetDir),
}
// ----------------
// InstallCommand Args
// ----------------
#[derive(Debug, Args)]
pub struct InstallCommand{
#[clap(subcommand)]
pub command: InstallSubCommand,
}
#[derive(Debug, Subcommand)]
pub enum InstallSubCommand {
/// Installs Homebrew
Brew,
/// Installs Chocolatey
Choco,
/// Installs Node.js
Node,
/// Installs Scarb
Scarb,
// This Installs Forge
Forge
}
// --------------------------------------
// GetDir: For passing the directory name
// --------------------------------------
#[derive(Debug, Args)]
pub struct GetDir {
/// Specifies the name of the project directory to initialize
pub dir_name: String
}