added support for globs in pi.ron
This commit is contained in:
parent
ad18c69f28
commit
058ea6a2f0
4 changed files with 16 additions and 9 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -138,7 +138,7 @@ checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
|
|||
|
||||
[[package]]
|
||||
name = "epitls-pi"
|
||||
version = "1.4.1"
|
||||
version = "1.5.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"clap",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "epitls-pi"
|
||||
version = "1.4.1"
|
||||
version = "1.5.0"
|
||||
edition = "2021"
|
||||
license = "GPL-3.0+"
|
||||
description = "A little helper tool meant to ease the developpment of the C piscine at EPITA/Toulouse."
|
||||
|
|
|
@ -94,6 +94,16 @@ impl Config {
|
|||
self.includes
|
||||
.iter()
|
||||
.map(|p| Self::try_absolute(p.clone()))
|
||||
.flat_map(|p| {
|
||||
if p.contains('*') {
|
||||
glob::glob(&p)
|
||||
.unwrap()
|
||||
.map(|p| p.unwrap().to_str().unwrap().to_string())
|
||||
.collect()
|
||||
} else {
|
||||
vec![p]
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,5 +1,3 @@
|
|||
use std::env;
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use config::Config;
|
||||
|
||||
|
@ -67,10 +65,10 @@ pub enum Commands {
|
|||
|
||||
/// Initializes a project directory configuration, useful for custom flags, includes and custop push messages.
|
||||
init {
|
||||
/// Identifier for the automated tests.
|
||||
prefix: String,
|
||||
/// Path to the folder containing the project.
|
||||
path: Option<String>,
|
||||
path: String,
|
||||
/// Identifier for the automated tests.
|
||||
prefix: Option<String>,
|
||||
/// e
|
||||
#[clap(short, long)]
|
||||
tests: bool,
|
||||
|
@ -151,8 +149,7 @@ fn main() {
|
|||
prefix,
|
||||
tests,
|
||||
} => {
|
||||
let path =
|
||||
path.unwrap_or_else(|| env::current_dir().unwrap().to_str().unwrap().to_string());
|
||||
let prefix = prefix.unwrap_or_else(|| ".".to_string());
|
||||
let prefix = prefix.trim().trim_end_matches('*');
|
||||
config::create(path.clone(), prefix.to_string());
|
||||
if tests {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue