GOTO — gt

#!/usr/bin/env elvish ############################################################## # # # goto function makes getting places in the file system easy # # # ##############################################################

use str use re use github.com/zzamboni/elvish-modules/dir use os fn goto {| @_args | if (== (count $_args) 0) { dir:cd e:exa -F -laahigHb --colour-scale --time-style=full-iso --icons=always } elif (== (count $_args) 1) { if (==s $_args[0] '--help') { e:goto --help } elif (or (==s $_args[0] '--version') (==s $_args[0] '-v')) { e:goto --version } elif (==s $_args[0] '-') { dir:cd - e:exa -F -laahigHb --colour-scale --time-style=full-iso --icons=always } else { var res = (e:goto $_args[0]) if (==s $res '') { if (os:is-dir &follow-symlink=$true $_args[0]) { cd $_args[0] e:exa -F -laahigHb --colour-scale --time-style=full-iso --icons=always } else { echo "error: "$_args[0]" not found" } } else { dir:cd $res e:exa -F -laahigHb --color-scale --time-style=full-iso --icons=always } } } else { e:goto $@_args } } fn g {| @_args | goto $@_args }

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.