Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please allow searching for a file or directory #68

Open
rrthomas opened this issue Jan 27, 2024 · 2 comments
Open

Please allow searching for a file or directory #68

rrthomas opened this issue Jan 27, 2024 · 2 comments

Comments

@rrthomas
Copy link

rrthomas commented Jan 27, 2024

At the moment type can be only file or directory; it would be good to be able to search for both. Use case: searching for .git in a context where there are sub-modules, and I want to find the nearest .git file or directory.

Thanks for find-up!

@sholladay
Copy link
Collaborator

I believe this would do the trick:

await findUp(async directory => {
	const gitPath = path.join(directory, '.git');
	const hasGit = await pathExists(gitPath);
	return hasGit && gitPath;
});

@rrthomas
Copy link
Author

Thanks! What I did instead was to use findup-sync, which just works with micromatch patterns.

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

No branches or pull requests

2 participants