MyNixOS website logo
Description

A tool that returns to a landmark parent directory.

A tool that outputs a parent directory with a landmark

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! Look in the source code, it’s easy.

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

Ret tries to get your current directory from your shell as a symbolic name using the $PWD environment variable.

Installing

This project is hosted on Hackage. You can install it via:

cabal install ret

This project is also redistributed for Nix in Nixpkgs under haskellPackages.ret.

Building

Clone the repository and run this in it:

cabal build
Metadata

Version

0.5.0.0

License

Executables (1)

  • bin/ret

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows