https://github.com/samth/find-parent-dir
Finding containing directories
https://github.com/samth/find-parent-dir
Last synced: 5 months ago
JSON representation
Finding containing directories
- Host: GitHub
- URL: https://github.com/samth/find-parent-dir
- Owner: samth
- Created: 2013-10-07T15:01:27.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-11-25T22:20:13.000Z (over 12 years ago)
- Last Synced: 2025-06-12T02:08:02.190Z (about 1 year ago)
- Language: Racket
- Size: 113 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Finding containing directories
This package provides utilities for examining parent
directories. As an example, `git` looks for a `.git`
directory in any parent directory of the current
directory. That would be expressed here as:
(find-parent-containing (current-directory) ".git")
## Exports
```
(find-parent-containing [start path-string?] [sentinel path-string?]) -> (or/c #f path?)
```
Finds a parent directory of `start` that contains `sentinel`, or returns `#f`.
```
(find-parent-dir [start path-string?] [pred (-> path? any)]) -> (or/c #f path?)
```
Finds a parent directory of `start` that matches `pred` or returns `#f`.
Originally by @offby1 here: https://gist.github.com/offby1/6862232