TangoMan75 / tools

TangoMan Tools is an awesome collection of small useful shell scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GH language GH license GH release GH stars Bash CI ShellCheck CI visitors

TangoMan Bash Tool

tools

TangoMan Bash Tools is an awesome collection of small useful shell scripts.

⏳ TL;DR

  1. Copy "tools" folder into your project.
  2. Source desired script in your own script.
source ./tools/src/colors/colors.sh
  1. Call desired function.
echo_info "Hello World !"

🎯 Features

TangoMan Bash Tool provides the following features:

⚑ colors.sh

A semantic set of colors for shell scripts.

print_colors

Try this in your script :

#!/bin/bash

CURDIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/colors/colors.sh

echo_primary   'This is primary text   (97m)'
echo_secondary 'This is secondary text (94m)'
echo_success   'This is a success      (32m)'
echo_danger    'This is a danger       (31m)'
echo_warning   'This is a warning      (33m)'
echo_info      'This is an info        (95m)'
echo_light     'This is light          (47;90m)'
echo_dark      'This is dark           (40;37m)'
echo
echo_label     "${PADDING}" 'label (32m):'; echo_primary 'This is a label'
echo_error     'This is an error (31m)'

echo_colors

#!/bin/bash

CURDIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/colors/colors.sh

alert_primary   'This is a primary alert   (1;104;97m)'
alert_secondary 'This is a secondary alert (1;45;97m)'
alert_success   'This is a success alert   (1;42;97m)'
alert_danger    'This is a danger alert    (1;41;97m)'
alert_warning   'This is a warning alert   (1;43;97m)'
alert_info      'This is a info alert      (1;44;97m)'
alert_light     'This is a light alert     (1;47;90m)'
alert_dark      'This is a dark alert      (1;40;37m)'

alert_colors

If you want to use Symfony theme for alerts use this file instead: /tools/src/colors/colors_sf.sh

alert_colors_sf

πŸ“ NOTE:

  • Version a is the same than default version without comments.
  • Version b is the same than default version with line feed at the end of each string.
  • Version c does not use variables (less clutter).
  • Version d is the same than version c with line feed at the end of each string.

⚑ get_latest_release.sh

Get repository latest release from github.

⚑ get_latest_tag.sh

Get repository latest tag from github.

⚑ download.sh

Download file with either curl or wget.

⚑ check_install.sh

This script is meant to quickly check for common apps installation.

check_install

⚑ check_root.sh

Throws error when user doesn't own root privileges.

⚑ check_versions.sh

Check version of some development tools.

⚑ compare_versions.sh

Compare two semantic versions.

⚑ hosts.sh

Edit your local /etc/hosts config from shell scripts.

⚑ is_installed.sh

Returns true when given application or command is available.

⚑ is_ubuntu.sh

Returns true when current operating system runs one of ubuntu version.

⚑ prompt_user.sh

Opens a user prompt for given value.

⚑ update_grub.sh

Updates GRUB on multiple patforms.

⚑ get_parameter.sh

Read parameter from .yaml file.

⚑ set_parameter.sh

Set parameter to .yaml file.

πŸš€ Installation

Just copy this folder into your project or import this repository into your git project as a submodule.

# with https
git submodule add https://github.com/TangoMan75/tools.git ./tools
# with ssh
git submodule add git@github.com:TangoMan75/tools.git ./tools

πŸ”₯ Usage

Place following snippet in your code.

#!/bin/bash

CURDIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/colors/colors.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/git/get_latest_release.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/git/get_latest_tag.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/network/download.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/check_install.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/check_root.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/check_versions.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/compare_versions.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/hosts.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/is_installed.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/is_root.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/is_ubuntu.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/prompt_user.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/system/update_grub.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/yaml/get_parameter.sh
# shellcheck source=/dev/null
. "${CURDIR}"/tools/src/yaml/set_parameter.sh

🀝 Contributing

Thank you for your interest in contributing to TangoMan Bash Tools.

Please review the code of conduct and contribution guidelines before starting to work on any features.

If you want to open an issue, please check first if it was not reported already before creating a new one.

πŸ“œ License

Copyrights (c) 2021 "Matthias Morin" <mat@tangoman.io>

License Distributed under the MIT license.

If you like TangoMan Bash Tools please star, follow or tweet:

GitHub stars GitHub followers Twitter

... And check my other cool projects.

About

TangoMan Tools is an awesome collection of small useful shell scripts

License:MIT License


Languages

Language:Shell 100.0%