up: Command-line tool to generate paths for moving upward in a file system

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Command-line tool to generate paths for moving upward in a file system.

[Skip to Readme]


Versions,,,, 1.0.0,,,,,,,,
Change log None available
Dependencies base (>= && <4.14), directory (>= && <1.4), filepath (>= && <1.5), lambda-options (>= && <1.2), mtl (>=2.2.2 && <2.3), split (>= && <0.3) [details]
License BSD-3-Clause
Author Thomas Eding
Maintainer Thomas Eding
Category Utils
Home page https://github.com/thomaseding/up
Bug tracker https://github.com/thomaseding/up/issues
Uploaded by ThomasEding at 2020-09-11T19:32:26Z


Maintainer's Corner

For package maintainers and hackage trustees

Readme for up-

[back to package description]

Homepage: https://github.com/thomaseding/up

Hackage: https://hackage.haskell.org/package/up

Install from git repository:

$ cabal configure
$ cabal build
$ cabal install

Install from Hackage.

$ cabal update
$ cabal install up

These will install the up command.

Example usage:

$ cd /home/thomas/code/up/src
$ up thomas
$ up --absolute thomas
$ up ....
$ up --relative --from-to /abc/def/xyz/ abc

See up --help for more info.

up generates file path strings, but it (by itself) does not change your current working directory. So below is code you can add to your shell's config file (e.g. .bashrc) to use the up program to change your directory.

g () {
    local DEST
    DEST=$(up "$@")
    if [ "$?" == '0' ]
        cd "$DEST"
        return "$?"

Example usage:

$ cd /home/thomas/code/up/src
$ g thomas
$ pwd

For shell autocomplete for the above g command, you can add this to your shell's config in addition:

_g () {
    if [ "$COMP_CWORD" == "1" ]
        local cur=${COMP_WORDS[COMP_CWORD]}
        local parts="$(pwd | tr '/' ' ')"
        COMPREPLY=( $(compgen -W "$parts" -- $cur) )
complete -F _g g