Initialize project structure with basic CLI setup
This commit is contained in:
29
src/cli/flags.rs
Normal file
29
src/cli/flags.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use clap::Parser;
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
path::PathBuf
|
||||
};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "pmp", about, version)]
|
||||
pub struct Args {
|
||||
#[arg(long)]
|
||||
php: Option<PathBuf>,
|
||||
|
||||
#[arg(long, short = 'd', hide = true)]
|
||||
debug: bool,
|
||||
#[arg(long, short = 'v')]
|
||||
verbose: bool,
|
||||
|
||||
#[arg(default_value_os = OsStr::new("."))]
|
||||
files: Vec<PathBuf>,
|
||||
#[arg(last = true)]
|
||||
passthrough: Vec<String>,
|
||||
}
|
||||
|
||||
impl Args
|
||||
{
|
||||
pub fn parse() -> Self {
|
||||
<Self as Parser>::parse()
|
||||
}
|
||||
}
|
||||
3
src/cli/mod.rs
Normal file
3
src/cli/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod flags;
|
||||
|
||||
pub use flags::Args;
|
||||
1
src/lib.rs
Normal file
1
src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod cli;
|
||||
8
src/main.rs
Normal file
8
src/main.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
use pmp::{ cli::Args };
|
||||
|
||||
fn main()
|
||||
{
|
||||
let args = Args::parse();
|
||||
|
||||
println!("{:?}", args);
|
||||
}
|
||||
Reference in New Issue
Block a user