The xxToolbelt is a simple yet powerful system for creating aliases, scripts, and tools in various programming and scripting languages entirely written in Bash. It aims to provide a cleaner and more efficient alternative to the traditional giant rc (.bashrc, .zshrc etc.) files that many of us rely on. This tool allows you to manage your custom commands and scripts effortlessly, making your development workflow more streamlined and organized. Remember when you had to write this small script that does X and then you forgot about it? With the xxToolbelt, you can easily manage and share your scripts with others so you won't lose them or forget about them anymore.
Some of the key features of the xxToolbelt include:
- No reloading of the shell required when adding or modifying scripts (after the initial setup).
- Support for multiple programming and scripting languages (not limited to bash).
- Easy to extend and customize.
- Mechanism to share snippets with others.
- Adaptability to different shells (bash, zsh, fish, etc.).
- Centralized requirements for all your tools/scripts (e.g., Python requirements.txt).
Check out the demos:
- xxToolbelt
- No dependencies except Bash;
- Dynamic reloading without the need to reload the shell;
- Can be included in every shell (bash, zsh, fish etc.);
- Support multiple programming and scripting languages (everything, as long as you can create a shebang for it);
- Really easily extendible and customizable;
- You can write and reuse scripts using wide variety of languages;
- Works really well with interpreted languages;
- You can use centralized requirements for all your tools/scripts - ex. Python requirements.txt to save storage;
- Portability - its one file and your scripts folder (optional);
- Easy version control;
- Must maintain a lot of separate files instead of one big rc (might as well be a pro);
- Loading time of compiled languages will be slow and some functionality limited (but still better than the standard way);
In your terminal as the current user type:
cd /tmp; git clone https://github.com/thereisnotime/xxToolbelt && mkdir "$HOME/.xxtoolbelt" && mv ./xxToolbelt/* "$HOME/.xxtoolbelt" && echo -ne "# START xxToolbelt\nsource \"$HOME/.xxtoolbelt/xxtoolbelt.sh\"\n# END xxToolbelt" >> "$HOME/.$(ps -p $$ -ocomm=)rc" && source "$HOME/.$(ps -p $$ -ocomm=)rc" && echo -ne "\n\e[1;32m======= xxToolbelt was installed. Try 'xxtb'\e[m\n"
In your ~/.bashrc or ~/.zshrc or whatever rc file you use paste (prefably in the end of the file):
# START xxToolbelt
source "$HOME/.xxtoobelt/xxtoolbelt.sh"
# END xxToolbelt
Clone (or symlink) the repository folder to your home directory (or wherever you want). Example:
git clone https://github.com/thereisnotime/xxToolbelt
cp -r ./xxToolbelt ~/.xxtoolbelt
Reload your terminal.
wget --no-check-certificate -O xxToolbelt.tar.gz https://github.com/thereisnotime/xxToolbelt/archive/main.tar.gz && tar -xf xxToolbelt.tar.gz && mkdir "$HOME/.xxtoolbelt" && mv ./xxToolbelt-main/* "$HOME/.xxtoolbelt" && echo -ne "# START xxToolbelt\nsource \"$HOME/.xxtoolbelt/xxtoolbelt.sh\"\n# END xxToolbelt" >> "$HOME/.$(ps -p $$ -ocomm=)rc" && source "$HOME/.$(ps -p $$ -ocomm=)rc" && echo -ne "\n\e[1;32m======= xxToolbelt was installed. Try 'xxtb'\e[m\n"
- Remove the lines from your rc file.
- (optional) Remove the folder for your scripts
rm -rf ~/.xxtoolbelt
.
The main configuration is located in xxtoobelt.sh
You can start TUI with:
xxtb
You can view CLI help with:
xxtb -h
For example if your script's name is xxtemplate-py.py type:
xxedit-xxtemplate-py
This will open your code editor (by default VSCode)
Save the file - that's all - no need to reload anything.
NOTE: The xxedit- command is automatically generated for each script.
- Add the new script with the proper extension to the correct language folder (or create one). It is recommended to use the templates and have the requirements (README.md in the language folder) because the shebang is important.
- Reload your shell or open a new terminal or type:
xxtb-load
Example:
You can export your scripts to a snippet with:
xxtb -e [scriptname]
Example:
NOTE: After the first load, you don't need to reload the shell or open a new terminal every time you change the script.
- Create the appropriate folder in /.xxtoolbelt/scripts/
- Whitelist its extension in your RC file in the XXTOOLBELT_SCRIPTS_WHITELIST array.
- Make sure that the shebang you are using works (test with bash ./yourscript.yourlanguage).
- Reload your shell or open a new terminal.
Edit XXTOOLBELT_SCRIPTS_EDITOR in your RC file.
Edit XXTOOLBELT_SCRIPTS_FOLDER in your RC file.
If you have any sensitive information in your scripts and use git, you can add ".private" before the script extension to ignore it for the git repository. Example xxmyscript.sh -> xxmyscript.private.sh. This will not affect the command, you will still call it with xxmyscript.
By default it is 2 levels (so you can use nested folders for your script's libraries). You can edit XXTOOLBELT_SCANNING_DEPTH in your RC file.
Should work fine with all POSIX compliant shells (and some of the not fully compliant ones). Tested with:
- Debian/Ubuntu/Arch/Manjaro
- bash/zsh
- Create oneliner for the installation of xxToolbelt.
- Add Julia.
- Add Kotlin.
- Add Haskell.
- Add Swift.
- Add Nim.
- Add Fortran.
- Add COBOL.
- Add Clojure.
- Add Scala.
- Add Dart.
- Add Delphi.
- Create dependency examples where they are missing.
- Test on macOS.
- Test on BSD.
- Add support for PowerShell Core.
- Implement architecture that allows easy installation of "script modules" from git repositories by URL.
- Add examples for .env secrets management for private scripts.
- Create a management menu for managing installed scripts.
- Create a mechanism for easily exchanging scripts with peers.
Here you can find examples of scripts in various languages that you can use with the xxToolbelt:
Check the Python README for more information.
Check the Ruby README for more information.
Check the Rust README for more information.
Check the R README for more information.
Check the PowerShell README for more information.
Check the Perl README for more information.
Check the Nodejs README for more information.
Check the Lua README for more information.
Check the Groovy README for more information.
Check the Java README for more information.
Check the Golang README for more information.
Check the Erlang README for more information.
Check the Elixir README for more information.
Check the Dlang README for more information.
Check the CSharp README for more information.
Check the Cpp README for more information.
Check the Bash README for more information.
Check the TypeScript README for more information.
Check the Janet README for more information.
Check the Zig README for more information.
Check the V README for more information.
We welcome contributions to xxToolbelt! You can help by creating issues or submitting pull requests. If scripting isn't your thing, you can still support the project by testing it with different shells, terminals, and OS versions. If you have questions or need assistance, please open an issue in the repository.
Check the LICENSE file for more information.
- GitHub gitignore