findup 0.1.0

Find the first file matching in a current working directory or the nearest ancestor directory up to root
docs.rs failed to build findup-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

findup.rs Build Status

A Rust tiny crate to find the first file matching in the current directory or the nearest ancestor directory up to root with Glob patterns support. Inspired in node's findup and Go findup

Note: this is still a hacking-driven just-for-fun alpha package as result of a couple of hours learning and playing with Rust

Usage

To use findup, add this to your Cargo.toml manifest

[dependencies]
findup = "0.1.0"

And add this to your crate root:

extern crate findup;

Example

extern crate findup;

use std::path;
use findup::findup;

fn main() {
  let file: Path = findup("my-file.*");
  assert_eq!(file.exists(), true);
  
  if file.as_str() == Some(".") {
    println!("File path: {}", file.display());
  } else {
    println!("File not found");
  }
}

License

MIT - Tomas Aparicio