Skip to content

Commit

Permalink
improve argument parsing and documentaion & generate screen into exis…
Browse files Browse the repository at this point in the history
…ting feature
  • Loading branch information
AradiPatrik committed May 1, 2023
1 parent 357cec9 commit af9d8ed
Show file tree
Hide file tree
Showing 7 changed files with 487 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/test
264 changes: 264 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ edition = "2021"
handlebars = "4.3.6"
convert_case = "0.6.0"
serde = "1.0.160"
clap = { version = "4.2.5", features = ["derive"] }
51 changes: 51 additions & 0 deletions src/args_parser.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(name = "Feature Generator")]
#[command(author = "Aradi Patrik <[email protected]>")]
#[command(version = "1.0")]
#[command(about = "Generates new features and screens inside them", long_about = None)]
pub struct Cli {
/// Turn debugging on
#[arg(short, long, action = clap::ArgAction::SetTrue)]
pub debug: bool,

/// base package name
#[arg(short, long)]
pub base_package: String,

/// Application name
#[arg(short, long)]
pub app_name: String,

#[command(subcommand)]
pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
/// Generates new feature module
GenMod {
/// The name of the new feature
#[arg(short, long)]
feature: String,

/// The name of the starting screen
#[arg(short, long)]
start_screen: String
},
/// Generates new screen for a feature module
GenScreen {
/// The name of the existing feature
#[arg(short, long)]
feature: String,

/// The name of the new screen
#[arg(short, long)]
screen: String
}
}

pub fn parse_args() -> Cli {
return Cli::parse()
}
Loading

0 comments on commit af9d8ed

Please sign in to comment.