8000 GitHub - oxmento/xxToolbelt: Manage your scripts and snippets, share them and run programming languages as scripts
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

oxmento/xxToolbelt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Organize your scripts


Lint Bash GitHub License GitHub commit activity stable

🛠 Powered by Bash 🛠

xxToolbelt

✨ Description

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:

📝 Table of Contents

👍 Pros

  • 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;

👎 Cons

  • 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);

🛠️ Installation

Install with git

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"

Manual install

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.

Install with wget

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"

🗑️ Uninstall

  1. Remove the lines from your rc file.
  2. (optional) Remove the folder for your scripts rm -rf ~/.xxtoolbelt.

📚 Usage

The main configuration is located in xxtoobelt.sh

TUI

You can start TUI with:

xxtb

TUI

CLI

You can view CLI help with:

xxtb -h

CLI

Modifying scripts

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.

Adding new scripts

  1. 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.
  2. Reload your shell or open a new terminal or type:
xxtb-load

Example:

Adding Scripts

Exporting scripts

You can export your scripts to a snippet with:

xxtb -e [scriptname]

Example:

Export a Script

NOTE: After the first load, you don't need to reload the shell or open a new terminal every time you change the script.

Adding new languages

  1. Create the appropriate folder in /.xxtoolbelt/scripts/
  2. Whitelist its extension in your RC file in the XXTOOLBELT_SCRIPTS_WHITELIST array.
  3. Make sure that the shebang you are using works (test with bash ./yourscript.yourlanguage).
  4. Reload your shell or open a new terminal.

Change default script editor

Edit XXTOOLBELT_SCRIPTS_EDITOR in your RC file.

Change scripts folder

Edit XXTOOLBELT_SCRIPTS_FOLDER in your RC file.

Private scripts

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.

Change script scanning depth

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.

⚙️ Compatability

Should work fine with all POSIX compliant shells (and some of the not fully compliant ones). Tested with:

  • Debian/Ubuntu/Arch/Manjaro
  • bash/zsh

🚀 Roadmap

  • 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.

🔍 Examples in Various Languages

Here you can find examples of scripts in various languages that you can use with the xxToolbelt:

Python

Check the Python README for more information.

Ruby

Check the Ruby README for more information.

Rust

Check the Rust README for more information.

R

Check the R README for more information.

PowerShell Core

Check the PowerShell README for more information.

Perl

Check the Perl README for more information.

Nodejs

Check the Nodejs README for more information.

Lua

Check the Lua README for more information.

Groovy

Check the Groovy README for more information.

Java

Check the Java README for more information.

Golang

Check the Golang README for more information.

Erlang

Check the Erlang README for more information.

Elixir

Check the Elixir README for more information.

Dlang

Check the Dlang README for more information.

CSharp

Check the CSharp README for more information.

Cpp

Check the Cpp README for more information.

Bash

Check the Bash README for more information.

TypeScript

Check the TypeScript README for more information.

Janet

Check the Janet README for more information.

Zig

Check the Zig README for more information.

V

Check the V README for more information.

🤝 Contribution

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.

📜 License

Check the LICENSE file for more information.

🙏 Acknowledgements

About

Manage your scripts and snippets, share them and run programming languages as scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 78.3%
  • Rust 3.8%
  • Lua 3.0%
  • C++ 2.8%
  • Zig 1.9%
  • Java 1.1%
  • Other 9.1%
0