Initialize project structure with basic CLI setup
This commit is contained in:
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
target/
|
||||||
|
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
*.pdb
|
||||||
|
**/*.rs.bk
|
||||||
12
Cargo.toml
Normal file
12
Cargo.toml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[package]
|
||||||
|
name = "pmp"
|
||||||
|
description = """\
|
||||||
|
PHP Macro Pre-processor (PMP) \
|
||||||
|
A php lexer, parser and macro pre-processor written in Rust. \
|
||||||
|
"""
|
||||||
|
|
||||||
|
version = "0.1.0-alpha"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clap = { version = "^4", features = ["derive"] }
|
||||||
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