Initialize project structure with basic CLI setup

This commit is contained in:
2026-03-02 20:13:38 +01:00
parent e464dae53d
commit e8cf10eee3
6 changed files with 62 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
.idea/
.vscode/
target/
Cargo.lock
*.pdb
**/*.rs.bk

12
Cargo.toml Normal file
View 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
View 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
View File

@@ -0,0 +1,3 @@
pub mod flags;
pub use flags::Args;

1
src/lib.rs Normal file
View File

@@ -0,0 +1 @@
pub mod cli;

8
src/main.rs Normal file
View File

@@ -0,0 +1,8 @@
use pmp::{ cli::Args };
fn main()
{
let args = Args::parse();
println!("{:?}", args);
}