Bash TUI is a library designed to enhance your terminal experience with a user-friendly command-line helper for Git and SVN, as well as utilities to manage parameters and output with style.
- Install the package.
- Copy the
.bash-tui-colors.conf
file from the project root to your home directory:~/.bash-tui-colors.conf
- Done!
This library provides a command-line helper for Git and SVN, displaying detailed context in a user-friendly manner:
[branch -> remote]
[Your PID][CWD][last $?]
[user@host time]#
Example:
- Multi-line display for improved readability on limited-width monitors.
- To disable the helper, edit
/etc/bash-tui.conf
and comment out or remove thetrue
value:BASHTUI_cline_repo_ENABLED=true
A wrapper for echo
that supports color-coded output and logging.
Usage:
. /usr/lib/bash-tui/say.sh
say "hello" blue
-
Prints
hello
in blue and logs it to/var/log/say_output.log
:[2025-01-01 06:09:38] hello
-
Configure logging:
_L_file_=$(date +%Y%m%d)_filename.log # Log file _L_dir_=/var/log/dir # Log Directory
-
Predefined keywords:
say "hello" debug # [DEBUG] message in blue say "hello" error # [ERROR] message in red say "hello" warning # [WARNING] message in yellow say "hello" exit # Prints message and terminates session say "hello" logonly # Logs only, without printing
A library to simplify parameter handling in Bash scripts.
Usage:
. /usr/lib/bash-tui/bashparms.sh
## Help
isParm help && _BP_getHelp && exit 113
what this does is automatically crawl your file for all instances in which you request or check a parameter and thanks to the comment after the keycomment ##BP:
takes the string after and adds it directly to the help.
Automatically generates a --help
message based on parameters defined in the script. Example:
loglevel=$(getParm loglevel) || loglevel=quiet ##BP: ffmpeg loglevel
Generates:
--loglevel
'--(ffmpeg loglevel)
A full example for --help is as shown:
Available methods:
isNoParm
: Checks if no parameters are set.setParm parameter 'value'
: Sets a parameter.isParm parameter
: Checks if a parameter is set.isNotParm parameter
: Checks if a parameter is not set.getParm parameter
: Retrieves the value of a parameter.
Command-line usage:
./software.sh --parameter -blah -cu 12 --test 'yes'
Results:
parameter: 1
b: 1
l: 1
a: 1
h: 1
c: 12
u: 12
test: 'yes'
Parameter files can also be used with --parametrizer /path/to/parameter/file
:
# Parametrizer file example
date yesterday
skip-sanitize
## Social
youtube
# thumbnail
thumbType freeform
thumb_ff_title 4K TRAILER
thumb_ff_rs1 LIVE 24/7
Comments will have to start at the beginning of the line and longer string don't need to be quoted, the bashparms will simply get the first word as the parameter and the rest as its value
Run colorshow
to list available colors. Example output:
Customize colors with colorset
:
colorset 148 banana
say "how are you?" banana
This library provides a collection of handy Bash functions to simplify various tasks, such as file management, process automation, and system utilities. Below is an overview of the available functions and their usage.
- File and Directory Utilities
- Search and Locate
- Process Utilities
- Package Management
- Version Comparison
- Character and String Utilities
- Other Utilities
Find all files in the current directory and its subdirectories, excluding .git
and .svn
repositories, matching the specified pattern.
List all directories in the current directory, excluding .git
and .svn
.
Display the last 50 modified files in the current directory. Add loop
to refresh the list every second.
Change to a directory, or its parent if a file is provided. Returns to the previous directory if no argument is given.
Update a local locate
database for the current directory and search for files matching the pattern.
Recursively search for a pattern in the current directory with colorized output, excluding .git
, .svn
, and other system directories.
Locate Perl modules by transforming module paths (e.g., Module::Path
) into file paths.
Send a Wake-on-LAN signal to a device by its predefined name.
Extract the contents of an RPM file into a new directory named after the package.
Identify the RPM package that contains a specific file. Optionally, return only the package name.
Compare two RPM-style versions:
- Returns
gt
ifversion1 > version2
. - Returns
lt
ifversion1 < version2
. - Returns
eq
if they are equal.
Convert an ASCII code to its corresponding character.
Get the ASCII code of a character.
Display each character of a string alongside its ASCII code.
Join strings with the specified delimiter.
Generate a timestamped log format for use with awk
.
Run svn blame
on a file and view the output in vim
.
Navigate to the directory of a symbolic link.
List broken symbolic links in the current directory. Add -d
to delete them.
Retrieve Udev properties for a specified device.
List all USB devices. Add -b
to output only device names.
Compile a C file with gcc
. Outputs a binary with the same base name.
- Some functions rely on external commands such as
gcc
,rpm
,locate
, andudevadm
. Ensure these are installed and available in your environment.
Contributions are welcome! Feel free to submit issues or pull requests.
This project is licensed under the GNU General Public License v2.0. You can redistribute it and/or modify it under the terms of the license. See the LICENSE file for the full text of the license.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Enjoy a better terminal experience with Bash TUI!