Skip to content

Commit

Permalink
close #240
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Pennebaker committed Jan 8, 2024
1 parent 4586d16 commit 9b948a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ The unmake dry run option aggressively assumes that most makefiles are buildable

This is useful for feeding large make projects into external linters. Unfortunately, many linters are poorly designed, lacking directory recursion and automatic file type identification. As a stopgap, unmake can perform these duties, exporting a subset of makefiles within a large project, through `xargs`, to an external linter.

Like `-n` / `--dry-run`, the list option automatically skips common machine generated makefiles.
Like dry run, the list option automatically skips common machine generated makefiles.

When piping unmake makefile lists through xargs, we recommend adding a `--print0` flag to unmake, and adding a `-0` flag to xargs. This informs both programs to transfer data in null delimited form, as a precaution against errors related to any spaces in file paths.

# WARNINGS

Expand Down Expand Up @@ -111,6 +113,7 @@ $ cargo install --force --path .

## Recommended

* GNU or BSD [findutils](https://en.wikipedia.org/wiki/Find_(Unix))
* POSIX compatible [make](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html)

# CONTRIBUTING
Expand Down
9 changes: 8 additions & 1 deletion src/bin/unmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fn main() {
opts.optflag("d", "debug", "emit additional logs");
opts.optflag("h", "help", "print usage info");
opts.optflag("l", "list", "list makefile paths");
opts.optflag("", "print0", "null delimit paths");
opts.optflag(
"n",
"dry-run",
Expand All @@ -55,6 +56,7 @@ fn main() {

let debug: bool = optmatches.opt_present("d");
let list_makefile_paths: bool = optmatches.opt_present("l");
let null_delimit_paths: bool = optmatches.opt_present("print0");
let process_dry_run: bool = optmatches.opt_present("n");

if optmatches.opt_present("i") {
Expand Down Expand Up @@ -106,7 +108,12 @@ fn main() {
}

if list_makefile_paths {
println!("{}", pth_string);
if null_delimit_paths {
print!("{}\0", pth_string);
} else {
println!("{}", pth_string);
}

return;
}

Expand Down

0 comments on commit 9b948a9

Please sign in to comment.