Pybcli is a command-line tool for managing and executing Bash functions, it supports neat autocompletion and seamless execution of functions over SSH without the need to manually copy the script to the remote server.
Long gone the days of forgetting where you put that one bash function that you need to run on a remote server.
- cli like with autocompletion
- Import a bash file (with functions) or directory into a namespace
- Execute a function from a file within a namespace
- Execute a function from a file within a namespace over SSH
- Auto-completion for bash functions and namespaces
- File management (display, purge, remove)
To install Pybcli, clone the repository and install the dependencies:
git clone https://github.com/saeedtx/pybcli.git
cd pybcli
# user
pip install .
bcli install-bash-completion
# system
sudo pip install .
sudo bcli install-bash-completion
# Restart your shell
exec bash
# Import a single file into the default namespace
bcli import /path/to/your/script.sh
# Import a single file into a custom namespace
bcli import /path/to/your/script.sh custom_namespace
# Import a directory into the default namespace
bcli import /path/to/your/scripts
# Import a directory into a custom namespace
bcli import /path/to/your/scripts custom_namespace
# Execute a function locally
bcli exec namespace script_name function_name arg1 arg2
# **Execute a function over SSH**
bcli exec --ssh user@remote_host namespace script_name function_name arg1 arg2
# Display configuration information with default verbosity
bcli info
# Display configuration information with increased verbosity
bcli info -v
bcli info -vv
bcli info -vvv
bcli purge
# Remove an entire namespace
bcli remove custom_namespace
# Remove a specific file within a namespace
bcli remove custom_namespace script_name
# Install system-wide (requires root)
sudo bcli install-bash-completion
# Install for the current user
bcli install-bash-completion
-
Import a script into the default namespace:
bcli import /home/user/scripts/my_script.sh
-
Execute a function from the imported script:
bcli exec default my_script my_function arg1 arg2
-
Import a directory of scripts into a custom namespace:
bcli import /home/user/scripts custom_namespace
-
Execute a function from a script in the custom namespace:
bcli exec custom_namespace my_script my_function arg1 arg2
-
Display configuration information:
bcli info
-
Purge non-existing files from metadata:
bcli purge
-
Remove a namespace:
bcli remove custom_namespace
-
Remove a specific file within a namespace:
bcli remove custom_namespace my_script
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.