GOTO — bash_aliases

## vim: :set filetype=raku :autoindent # ############################################################## # # # goto function makes getting places in the file system easy # # # ##############################################################

if [ -n "$RAKULIB" ] then export RAKULIB="$RAKULIB,$HOME/rakulib" else export RAKULIB="$HOME/rakulib" fi

# shellcheck disable=SC2120 function eb(){ if type exa >> /dev/null 2>&1 then exa -F -laahigHb --color-scale --time-style=full-iso --icons=always "$@" else ls -Flaghi --color "$@" fi }

function goto(){ case $# in 0) cd eb;; 1) if [[ "$1" == "--help" ]] then #USAGE="$(paths.raku --help)" #echo "${USAGE//paths.raku/goto}" command goto --help elif [[ "$1" == "--version" ]] || [[ "$1" == "-v" ]] then command goto --version elif [[ "$1" == "-" ]] then cd - # shellcheck disable=SC2119 eb else arg=$(command goto "$1") if [ -z "$arg" ] then if [ -d "$1" ] then cd "$1" eb else echo "error: $1 not found" fi else cd "$arg" # shellcheck disable=SC2119 eb fi fi;; *) command goto "$@";; esac }

function g(){ case $# in 0) cd eb;; 1) if [[ "$1" == "--help" ]] then #USAGE="$(paths.raku --help)" #echo "${USAGE//paths.raku/g}" command g --help elif [[ "$1" == "--version" ]] || [[ "$1" == "-v" ]] then command g --version elif [[ "$1" == "-" ]] then cd - # shellcheck disable=SC2119 eb else arg=$(command goto "$1") if [ -z "$arg" ] then if [ -d "$1" ] then cd "$1" eb else echo "error: $1 not found" fi else cd "$arg" # shellcheck disable=SC2119 eb fi fi;; *) command goto "$@";; esac }

## vim: :set filetype=sh :autoindent #

GOTO v0.1.71

GOTO is a mixture of a Raku app path.raku and a module Paths.rakumod (implemented separately) that implements it and a set of scripts to apply them inside a shell instance This is important as you need the scripts to call cd from within the shell process in order to actually change it's current directory otherwise we would only change a subprocesses current directory and then nothing would have been achieved on exit. The scripts are applied by running goto-init init [--shell=SHELL] [--config=CONFIG-FILE]. run ```bash goto init --shell=SHELL --config=CONFIGFILE ``` Where - `--shell=SHELL` defaults to bash and - `--config=CONFIG` defults to ~/.bashrc for bash and either ~/.local/share/elvish/rc.elv or $XDG_DATA_HOME/elvish/rc.elv if XDG_DATA_HOME is set in your environment *NB: no other shells are supported at this time.*

Authors

  • Francis Grizzly Smit

License

GPL-3.0-or-later

Dependencies

Terminal::ANSITerminal::WCWidthTerminal::WidthGzz::Text::UtilsSyntax::HighlightersGUI::EditorsDisplay::ListingsFile::UtilsTerminal::ANSIECMA262RegexGzz::Paths

Test Dependencies

Provides

    The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

    Built with Podlite — the markup and publishing tools behind this site.