Cause I'm Lazy. A script that you put in your path and you get a bunch of aliases to go to folders and run commands. Only works in bash (and maybe zsh).
- Put the
lz
script somewhere and add it to your path. Don't forget to give it execute permissions. - Set the variable
LZ_SCRIPTS_FOLDER
to the folder where you will put your scripts. You may want to put this in your.bashrc
or.zshrc
file.
- Put bash scripts in the scripts folder with
.lz.sh
as the extension. This is so that you can have other bash scripts in the folder that don't get loaded. - Define the functions that you want to invoke with
lz
. Put the line## lz function
before the function for it to be registered (the comment should start the line). Note that the corresponding script name to your function will be made by replacing the underscores by hyphen.
- Run
. lz
to see available scripts (you can run. lz -l
to see only functions and nothing else, useful if you want to use in an array) - Run
. lz <script name>
to run the script
Since the script is meant to be used after source
or .
, the only way to get tab completion is to add tab completion is for the source
command. To do this, you can source the file lz_source_completion.sh
in src
folder. Note some things
- It is assumed that you source this file after adding the
lz
script to your path. - It is assumed that you have not modified tab completion for
source
or.
for something else. If you have, then check the comment in that file.
I in particular put the completion script in the lz scripts folder and then source it in my .bashrc
file.