Skip to content

Allow passing a specific directory to rule-preprocessor#226

Open
joaotgouveia wants to merge 1 commit into
Cpp2Rust:masterfrom
joaotgouveia:rule-preprocessor-args
Open

Allow passing a specific directory to rule-preprocessor#226
joaotgouveia wants to merge 1 commit into
Cpp2Rust:masterfrom
joaotgouveia:rule-preprocessor-args

Conversation

@joaotgouveia

@joaotgouveia joaotgouveia commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Adds an optional command-line argument that allows specifying a directory other than the default ../rules.

let out_dir = args
.next()
.expect("usage: rule-preprocessor <out-dir> [rules-crate-dir]");
let in_dir = args.next().unwrap_or_else(|| "../rules".to_string());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should terminate the program if the dir is not found. Otherwise it will create confusion when someone wants to use dir X and instead it fallbacks to rules/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback to ../rules only happens when the argument is not provided, i.e., it acts as a default argument. If the provided directory is not found, the program terminates with a No such file or directory error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants