Ret
Ret is a tool that goes up the directory chain and returns the first directory with a landmark.
A landmark is an important property of the directory, such as the existence of a configuration file, being the user’s home directory, or being on a different drive.
This project is hosted on GitHub.
This project is on Hackage.
How to use
You can use this to go back to your project root in a jiffy by using your shell’s command substitution syntax,
e.g.:
cd $(ret)
or
cd (ret)
You can specify a set of landmark names as the arguments to ret
to only use them.
You can also specify a set of default landmark names in $XDG_CONFIG_HOME/ret/landmarks.txt
, one per line.
You are invited to contribute more landmark specifications! Or send me an email if you want one added.
Installing
Note: All install methods except the NixOS one are untested by the author.
Shell integration
After installing (see below), you can make using ret
even more convenient by defining a shell function that does cd
for you.
e.g.
ret() {
cd $(command ret "$@")
}
or
function ret
cd (command ret $argv)
end
Manual install
You can, of course, manually copy the ret
binary into a location of your choice.
You can download the binary from the GitHub releases or build it yourself.
Hackage install
This package is published on Hackage. You can install it using cabal-the-tool:
cabal install ret
Debian install
Warning: The Debian package is produced without care and has a wrong version number.
You can install the Debian package that’s downloadable from the GitHub releases page using dpkg
or apt
or another frontend.
Cabal install
Clone this repository and run
cabal install
NixOS install
This repository provides a Nixpkgs overlay you can use to get this into your flake-based NixOS or home-manager config.
Add github:schuelermine/ret
to your inputs, add ret.overlays.default
to your overlays, and add ret
to your packages.
How to build
You can build it using The Haskell Cabal or Nix.
Cabal build
Use cabal-the-tool:
cabal build
Nix build
First, enable the nix-command and flakes experimental features.
Then, run:
nix build
Build a Debian package
Make sure that you have Nix installed and enabled the nix-command and flakes experimental features.
nix bundle --bundler bundlers#toDEB