#root-directory #root-finding #version-control #determine #alias #up #mode

app projroot

Small tool to guess the root directory of the project containing the current working directory

1 unstable release

0.1.0 Jun 29, 2023

#1294 in Development tools

ISC license

8KB
133 lines

This is a tiny application for finding the root of a project.

CI Crates.io

I would recommend setting it up as an alias in your shell; something like

alias cdpr "cd (projroot)"

This project is heavily-inspired by vim-rooter.

If you work a lot with submodules or other use cases where the first VCS directory doesn't represent the root of your project, you might try the -m farthest mode to instead look for the most distant VCS directory.

We currently use the presence of any of the following to determine if something is a project root:

  • .git
  • _darcs
  • .hg
  • .bzr
  • .svn

This should work on all supported Rust platforms, although the single-filesystem functionality only works on Unix-like platforms. It even works on WASI with wasmtime, presuming you grant FS access!

This work is licensed under the ISC license, a copy of which can be found at LICENSE.txt

Development

This project uses pre-commit; please install it and set up the hooks with pre-commit install.

Dependencies

~1.4–2MB
~37K SLoC